Templates and static members don't mix particularly well. Template code is only created when an instance of the template type is declared:
template <class T>class Thing{public: T thing;};// the above template declaration does not create any code at allThing <int> an_instance_of_a_thing;// the above instatiates the template and creates the code for the instance(*)
So, if you had a static member in the template, the declaration:
Thing <typename>::static_member_type Thing <typename>::static_member;
doesn't create anything since you've not specified a template parameter. To create the code, you need to provide a template parameter:
Thing <int>::static_member_type Thing <int>::static_member;
But that doesn't really help because you'd have to write that line for each type the template could be instantiated with, which defeats some of the ideas behind templates. As a result of that:
Thing <int>::static_memberThing <float>::static_member
are two different variables, assigning to one will not affect the other.
So, do you want a single static member variable shared accross all types or will manual instantiation of the member be OK (i.e. a separate one for each type)?
Skizz
(*) As a result of this, instantiating two instances of a template produces twice as much code as instantiating one instance of a template.(**)
(**) Although it does depend on the type used to instantiate the template.(***)
(***) But modern compilers might be able to do some smart stuff to reduce this.