home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / cplus / 12551 < prev    next >
Encoding:
Internet Message Format  |  1992-08-19  |  1.1 KB

  1. Path: sparky!uunet!pipex!unipalm!uknet!mcsun!corton!seti!goudurix.inria.fr!edelson
  2. From: edelson@goudurix.inria.fr (Daniel Edelson)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: template static data members
  5. Message-ID: <4086@seti.UUCP>
  6. Date: 19 Aug 92 08:42:56 GMT
  7. References: <Bt5FDH.DFK@apollo.hp.com>
  8. Sender: news@seti.UUCP
  9. Reply-To: Daniel R. Edelson <edelson@sor.inria.fr>
  10. Organization: INRIA -- Institut National de Recherche en Informatique et Automatique -- Rocquencourt, France
  11. Lines: 23
  12.  
  13. In article <Bt5FDH.DFK@apollo.hp.com>, vinoski@apollo.hp.com (Stephen Vinoski) writes:
  14. |> 
  15. |> ...
  16. |> 
  17. |>     template<class T> Simple LessSimple<T>::s;
  18. |> 
  19. <problem and explanation omitted>
  20. |> 
  21. |> Unfortunately, in the example case
  22. |> above, ``s'' cannot be explicitly initialized, and the problem cannot
  23. |> be solved without changing the declaration of Simple so such
  24. |> initialization is allowed (if possible).
  25. |> 
  26. |> -steve
  27.  
  28. Can't it be initialized with a temporary which the compiler
  29. may or may not optimize away?
  30.  
  31.     template<class T> Simple LessSimple<T>::s = Simple();
  32.  
  33. (Not that this makes the bug much less annoying.)
  34.  
  35. daniel
  36.