I have a struct
which indicates a trait:
template<typename T>
struct FooTraits
{
static const NEbool s_implementsFoo = false;
};
And I can specialize it with a class, thus:
class Apple {};
template<>
struct FooTraits< Apple >
{
static const NEbool s_implementsFoo = true;
};
However currently I cannot use FooTraits
if the class I wish to specialize it on is also templatized, thus:
template< typename T >
class Fruit {};
template<>
struct FooTraits< Fruit >
{
static const NEbool s_implementsFoo = true;
};
How should I express this last block of code so any Fruit< T >
has s_implementsFoo = true
?
Currently the following errors are reported:
error C3203: 'Fruit' : unspecialized class template can't be used as a template argument for template parameter 'T', expected a real type
error C2955: 'Fruit' : use of class template requires template argument list
see declaration of 'Fruit'
error C2990: 'FooTraits' : non-class template has already been declared as a class template
see declaration of 'FooTraits'