home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!sun-barr!cs.utexas.edu!zaphod.mps.ohio-state.edu!caen!umeecs!umn.edu!bru!sabaac!stan
- From: stan@sabaac.NoSubdomain.NoDomain (Andrew Staniszewski)
- Subject: initializing static members in template classes
- Message-ID: <1992Aug18.201754.4027@bmw.mayo.edu>
- Sender: stan@sabaac (Andrew Staniszewski)
- Reply-To: staniszewski@mayo.edu
- Organization: Mayo Foundation
- Date: Tue, 18 Aug 92 20:17:54 GMT
- Lines: 22
-
- Does anyone know how to do this?
-
- Lippman claims (see page 370 of the c++ primer) that using
-
- template <class T> QueueItem<T> *QueueItem<T>::free_list =0;
-
- will generate the define the freelist and assign it a value of 0 with each
- instanciation of the QueueItem class. when I try to use this syntax for my own
- class in an appropriate header file I get
-
- ie:
-
- template<class Type> ListLink<Type> * ListLink<Type>::freelist = 0;
-
- the DEC cxx compiler calls it an invalid declerator.
-
-
- Note I assumed that this sort of declration has to go into the header file,
- because if it goes into a source file, then the compiler wouldn't see it for
- every instantiation of the class.
-
- Is my syntax bad or is this simply a feature DEC hasn't implimented yet ???
-