home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.lang.c++:16392 comp.std.c++:1577
- Newsgroups: comp.lang.c++,comp.std.c++
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!zaphod.mps.ohio-state.edu!uwm.edu!ux1.cso.uiuc.edu!news.cso.uiuc.edu!meibm31.cen.uiuc.edu!pl2440
- From: pl2440@meibm31.cen.uiuc.edu (Paul Jay Lucas)
- Subject: Re: Proposal - enhancement for switch statement.
- References: <1992Nov16.004558.9855@muddcs.claremont.edu> <1992Nov16.213015.1@vax1.bham.ac.uk>
- Message-ID: <Bxu298.En3@news.cso.uiuc.edu>
- Sender: usenet@news.cso.uiuc.edu (Net Noise owner)
- Organization: University of Illinois at Urbana
- Date: Mon, 16 Nov 1992 23:51:07 GMT
- Lines: 22
-
- In <1992Nov16.213015.1@vax1.bham.ac.uk> mccauleyba@vax1.bham.ac.uk (Brian McCauley) writes:
-
- >Now (as promised) why ranges would be unnecessary (following the "if you
- >can do it with a class then don't extend the language" rule ;-) )
-
- >template <class T> class Range {
- > T top,bottom;
- >public:
- > Range(t,b) : top(t),bottom(b) {}
- > int operator==(T t) { return bottom <= t && top >= t; }
- >}
- >template <class T> inline operator == (T& t,Range<T>& r) {return r == t;}
-
- >switch (i) {
- > case Range<char>('0','9') : case '-' : {/*...*/} break;
- >}
-
- *****> Both cfront 3.0.1 and I think the above is illegal.
- --
- - Paul J. Lucas University of Illinois
- AT&T Bell Laboratories at Urbana-Champaign
- Naperville, IL pjl@cs.uiuc.edu
-