home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / cplus / 12522 < prev    next >
Encoding:
Text File  |  1992-08-18  |  1.2 KB  |  34 lines

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