🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #2782

Initialization fo template static components?

#2782
From: Ken Walter
Date: Wed, 29 Nov 1995 18:11
34 lines
1280 bytes
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. ]
Technical Details
Message-ID: <49i0v8$1q9m@news.gate.net>
Path: arc1-ca.pugleaf.net!128.32.155.1!matt

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!128.32.155.1!matt
From: solution@gate.net (Ken Walter)
Newsgroups: comp.std.c++
Subject: Initialization fo template static components?
Date: 29 Nov 1995 18:11:36 GMT
Organization: Solution Technology
Approved: matt@physics2.Berkeley.EDU (Matt Austern)
Message-ID: <49i0v8$1q9m@news.gate.net>
NNTP-Posting-Host: physics2.berkeley.edu