static variable in templates
I ran into a problem with templates. What do I do to access a static member for a templated class?
I want the same static variable for every type of instantaniation of the class.
When I tried these I got errors.
Code:
template<int ivar = 5>
class MyClass{
public:
static double stvar;
//blah...
};
MyClass::stvar = .5; //syntax error before '::' token.
double MyClass::stvar = .5; //Multiple defenition of MyClass<5>::stvar
What is happening here? and How do I access the static variable?