I have a vector class which has some static const variables like ZERO
. Now since vector is often implemented as a template class (and mine is no exception), I s
It's OK.
Templates are a kind of way to tell the compiler to generate similar code for different types.
This is exactly what it's for.
No, that's perfectly legitimate and totally Standard. If you want to use a static variable in a templated class, there's no way you could possibly define all possible instantiations of it- those types may not even be nameable and therefore specializable. Hence, it's very necessary that template classes can have static variables defined for all possible uses.