home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / cplus / 16816 < prev    next >
Encoding:
Internet Message Format  |  1992-11-24  |  1.2 KB

  1. Xref: sparky comp.lang.c++:16816 comp.std.c++:1612
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!darwin.sura.net!sgiblab!sgigate!odin!twilight!zola!fido!shankar
  3. From: shankar@sgi.com (Shankar Unni)
  4. Newsgroups: comp.lang.c++,comp.std.c++
  5. Subject: Re: "Invalid" argument(s) in template class declaration, how to realize?
  6. Date: 24 Nov 1992 01:00:23 GMT
  7. Organization: Silicon Graphics, Inc.
  8. Lines: 19
  9. Message-ID: <1erur7INNkem@fido.asd.sgi.com>
  10. References: <BxznCM.K9o@math.uwaterloo.ca>
  11. NNTP-Posting-Host: boris.wpd.sgi.com
  12. X-Newsreader: Tin 1.1 PL5
  13.  
  14. Xiaojun Zhu (xjzhu@math.uwaterloo.ca) wrote:
  15.  
  16. > Q: When designing a template class, how to make sure that its argument
  17. >    can only be certain classes or certain predefined types?
  18. > Another words, can we build a template class such that it only accepts 
  19. > certain types as its arguments, while for others it will generate an
  20. > error message such as:
  21. >    This type is not supported by this template.
  22.  
  23. You can't do that now, but if the proposal for RTTI (Run-Time Type
  24. Identification) ever gets into the standard in some form, you will be
  25. able to do this by doing a run-time check (usually statically
  26. determinable by the compiler).
  27.  
  28. --
  29. Shankar Unni                E-Mail:    shankar@sgi.com
  30. Silicon Graphics Inc.            Phone:    +1-415-390-2072
  31.