I have an existing struct as follows:
template<typename T>
struct Foo
{
T bar;
Foo() {}
Foo(T bar) : bar(bar) {}
};
How do I provide a specialization so that T bar
is set to a value? I attempted to use the methods outlined in this question by using the following:
template<>
Foo<ClassA>::bar = nullptr;
But this gave the following errors in Visual Studio 2015:
Foo
:-
this declaration has no storage class or type specifier
bar
:-
ClassA Foo::bar [with T=ClassA]" is not an entity that can be explicitly specialized