home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.lang.c++:16648 comp.std.c++:1605
- Newsgroups: comp.lang.c++,comp.std.c++
- Path: sparky!uunet!gumby!wupost!cs.uiuc.edu!sparc0b!pjl
- From: pjl@cs.uiuc.edu (Paul Lucas)
- Subject: Re: "Invalid" argument(s) in template class declaration, how to realize?
- Message-ID: <By0xqn.M1C@cs.uiuc.edu>
- Keywords: template, argument
- Sender: news@cs.uiuc.edu
- Organization: University of Illinois at Urbana-Champaign
- References: <BxznCM.K9o@math.uwaterloo.ca>
- Date: Fri, 20 Nov 1992 16:56:47 GMT
- Lines: 25
-
- In <BxznCM.K9o@math.uwaterloo.ca> xjzhu@math.uwaterloo.ca (Xiaojun Zhu) writes:
-
- >Q: When designing a template class, how to make sure that its argument
- > can only be certain classes or certain predefined types?
-
- *****> You can't. When instantiation takes place, the user will get
- an error message that something is inappropriate. If your class
- is documented, this shouldn't be a real problem, i.e., the user
- has to RTFM on your class.
-
- >How do we provide such a mechanism?
-
- *****> IMHO, there's nothing wrong with the way it's done now.
-
- >P.S. While I am writing this down, I feel this is probably a hard question,
- > because, I think, the template of C++ doesn't provide such property?
- >(Well, just guess, don't get offended if it actually does.) How hard
- >will be a work around?
-
- *****> If you insist, perhaps #pragma's and/or #error's to sugar-coat
- the error messages.
- --
- - Paul J. Lucas University of Illinois
- AT&T Bell Laboratories at Urbana-Champaign
- Naperville, IL pjl@cs.uiuc.edu
-