"Nils" <sl***@web.de> wrote...
Ich have a template class and want to initialize a static variable, that
is available for all objekts of the template class, doesn't matter what
template parameter is used.
You mean, like this:
template<class T> struct NilsClass {
static int someStaticVar;
};
// definition of the static member of the template
template<class T> int NilsClass<T>::someStaticVar = 42;
#include <iostream>
int main() {
NilsClass<double> d;
std::cout << d.someStaticVar << std::endl;
NilsClass<std::ostream> dd;
std::cout << dd.someStaticVar << std::endl;
}
Victor