Article View: comp.std.c++
Article #2989Initialization of Static Components of a Template Class
From: Ken Walter
Date: Mon, 08 Jan 1996 23:05
Date: Mon, 08 Jan 1996 23:05
29 lines
1105 bytes
1105 bytes
If I have a template class such as:
template<class T> SOMEclass
{
..
private:
static int AStatic;
}
I would like to also be able to say in the header file:
template<class T> int SOMEclass::AStatic(0);
and have it automaticaly expanded by the compiler with the template class.
Requiring the users of the template class to initialize ever class instance
is very inconvenient! It almost forces one to use a macro:
#define SOMEclassSTATICS( T ) int SOMEclass<T>::AStatic(0); /
// other initialization of SOMEclass statics
Or am I missing somrthing from the latest language definition?
Ken Walter
* All the above is hearsay and the opinion of nobody in particular
Technical Details
Message-ID:
<4cr2m1$1kcq@news.gate.net>Path:
arc1-ca.pugleaf.net!chronicle.mti.sgi.com!newsShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!chronicle.mti.sgi.com!news From: solution@gate.net (Ken Walter) Newsgroups: comp.std.c++ Subject: Initialization of Static Components of a Template Class Date: 08 Jan 1996 23:05:11 GMT Organization: Solution Technology Approved: austern@mti.sgi.com Message-ID: <4cr2m1$1kcq@news.gate.net> NNTP-Posting-Host: isolde.mti.sgi.com X-Newsreader: NeoLogic News for OS/2 [version: 4.2]