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

  1. Xref: sparky comp.lang.c++:16648 comp.std.c++:1605
  2. Newsgroups: comp.lang.c++,comp.std.c++
  3. Path: sparky!uunet!gumby!wupost!cs.uiuc.edu!sparc0b!pjl
  4. From: pjl@cs.uiuc.edu (Paul Lucas)
  5. Subject: Re: "Invalid" argument(s) in template class declaration, how to realize?
  6. Message-ID: <By0xqn.M1C@cs.uiuc.edu>
  7. Keywords: template, argument
  8. Sender: news@cs.uiuc.edu
  9. Organization: University of Illinois at Urbana-Champaign
  10. References: <BxznCM.K9o@math.uwaterloo.ca>
  11. Date: Fri, 20 Nov 1992 16:56:47 GMT
  12. Lines: 25
  13.  
  14. In <BxznCM.K9o@math.uwaterloo.ca> xjzhu@math.uwaterloo.ca (Xiaojun Zhu) writes:
  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.  
  19. *****>    You can't.  When instantiation takes place, the user will get
  20.     an error message that something is inappropriate.  If your class
  21.     is documented, this shouldn't be a real problem, i.e., the user
  22.     has to RTFM on your class.
  23.  
  24. >How do we provide such a mechanism?
  25.  
  26. *****>    IMHO, there's nothing wrong with the way it's done now.
  27.  
  28. >P.S. While I am writing this down, I feel this is probably a hard question,
  29. >  because, I think, the template of C++ doesn't provide such property?
  30. >(Well, just guess, don't get offended if it actually does.)  How hard
  31. >will be a work around? 
  32.  
  33. *****>    If you insist, perhaps #pragma's and/or #error's to sugar-coat
  34.     the error messages.
  35. -- 
  36.     - Paul J. Lucas                University of Illinois    
  37.       AT&T Bell Laboratories        at Urbana-Champaign
  38.       Naperville, IL            pjl@cs.uiuc.edu
  39.