First of all, I regret the vague title of this question. I was not sure how to generalize this.
What I want to achieve is the following: I want to be able to pass template non-peak parameters of different types to the same class template, which leads to different instances. Something like that:
Foo<1>(); Foo<'1'>(); // different types of object
I don’t think it’s possible, so I have to do something like this
template <typename T, T Val> struct Foo; template <int Val> struct Foo<int, Val> {}; template <char Val> struct Foo<char, Val> {};
that Foo can be specialized based on the first template parameter. However, this complicates the syntax of the mini-language, which I am trying to implement in my metaprogramming structure. Is there any technical ability to distinguish between Foo<1> and Foo<'1'> ? Basically what I want to do is set the compile-time flag (in the listing) to indicate that int or char passed, without explicitly specifying them.
EDIT Answers made me realize that my question implies that I really need instances of these objects (compilation time). I do not...
Say that somehow the standard would allow me to overload the class template so that Foo<1> and Foo<'1'> are different types and contain different values for their flag field. Then these types can be passed to another class template that can check them and do interesting things with it, for example:
template <typename FooType> struct Bar { typedef typename If < FooType::flag, int, char >::Type Type; };
This is very easy to do if you have nothing against type passing explicitly, but it seems superfluous ...