У меня есть struct
, который указывает черту:
template<typename T>
struct FooTraits
{
static const NEbool s_implementsFoo = false;
};
И я могу специализировать его на классе, таким образом:
class Apple {};
template<>
struct FooTraits< Apple >
{
static const NEbool s_implementsFoo = true;
};
Однако в настоящее время я не могу использовать FooTraits
если класс, на котором я хочу специализироваться, также является шаблонным, то есть:
template< typename T >
class Fruit {};
template<>
struct FooTraits< Fruit >
{
static const NEbool s_implementsFoo = true;
};
Как мне выразить этот последний блок кода, чтобы у любого Fruit< T >
был s_implementsFoo = true
?
В настоящее время сообщается о следующих ошибках:
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'