struct Bar {
enum { Special = 4 };
};
template struct Foo {};
template struct Foo {};
U
Since that is not allowed by C++ as explained by Prasoon, so an alternative solution would be to use EnumToType class template,
struct Bar {
enum { Special = 4 };
};
template
struct EnumToType
{
static const int value = e;
};
template //note I changed from "int K" to "class K"
struct Foo
{};
template
struct Foo >
{
static const int enumValue = T::Special;
};
Sample code at ideone : http://www.ideone.com/JPvZy
Or, you can simply specialize like this (if it solves your problem),
template struct Foo {};
//usage
Foo f;