Topic: Initialization fo template static components?


Author: solution@gate.net (Ken Walter)
Date: 1995/11/29
Raw View
If I have a template class with static components, it would be nice if the
template instantiator also did likewise expanded static component
initializers.  It is very awkward to require users of a template to initialize
private static components when I already know what they should be.

Example:

template< class T> class MYstuff
 {
private:
 static T* myPtr;
..
 }

I would like to say something like:

template <class T> T* MYstuff::myPtr = 0;

and have the compiler generate the initialization when it generates the
particular instance.

Anything like this possible or contemplated?

Ken Walter

* All the above is hearsay and the opinion of nobody in particular



---
[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]