Is it implemented already, because this does not compile: (using gcc 4.7.2)
template <typename... Ts>
struct Foo {
int foo() {
return 0;
}
};
template <>
struct Foo<int x, int y> {
int foo() {
return x * y;
}
};
int main()
{
Foo<2, 3> x;
cout << x.foo() << endl; //should print 6
}
You are making a few mistakes. The primary template expects types, not
integral constants. You also try to instantiate the template with
integral constants, but your partial specialization uses types.
This is closer:
But this is not really what we want, right? And it is also clumsy.
A simpler variant handling only int: