home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / std / cplus / 1132 < prev    next >
Encoding:
Text File  |  1992-09-08  |  716 b   |  32 lines

  1. Newsgroups: comp.std.c++
  2. Path: sparky!uunet!wupost!sdd.hp.com!usc!rpi!batcomputer!cornell!moudgill
  3. From: moudgill@cs.cornell.edu ( Mayan Moudgill)
  4. Subject: Is coercion to a reference defined?
  5. Message-ID: <1992Sep6.182905.6603@cs.cornell.edu>
  6. Organization: Cornell Univ. CS Dept, Ithaca NY 14853
  7. Date: Sun, 6 Sep 1992 18:29:05 GMT
  8. Lines: 22
  9.  
  10. I'm trying to implement an embedded list template class.
  11. It looks something like:
  12.  
  13. template <class T> class emList {
  14.    ...
  15.    emList *    _next;
  16.    T           _value;
  17.    ...
  18. };
  19.  
  20. I'd like to define TWO functions:
  21.  
  22.      operator T () { return _value;}
  23.  
  24. and
  25.      operator T& () { return _value;}
  26.  
  27. Is the second definition legal?
  28. How would the compiler resolve them?
  29.  
  30. :)
  31. Mayan
  32.