Article View: comp.std.c++
Article #1678Re: STL operators != > <= >=
From: Joe Buck
Date: Wed, 09 Aug 1995 02:07
Date: Wed, 09 Aug 1995 02:07
26 lines
1708 bytes
1708 bytes
matt@physics.berkeley.edu writes: >Maybe I'm missing something, but I don't see anything in the standard >that's in need of correction. Yes, there's a template definition of >other comparison operators in terms of operator< and operator==, and >yes, that definition is incorrect for some types. But isn't that what >template specialization is for? In the APL language, the "<" operator, when used with two arrays of matching size, returns an array of boolean values, not a single bool (the results of comparisons on corresponding elements). Similarly for other relational operators. The STL template declaration gives *every* class type a set of relational operators that return bool. This is a conflict that can only be worked around by never using any STL header in code that implements or uses an "APLarray" class. The STL approach basically mandates that the relational operators *always* return bool, even for user-defined classes. Now perhaps that is reasonable, but it is a decision that should be thought about just a bit. -- -- Joe Buck <jbuck@synopsys.com> (not speaking for Synopsys, Inc) Anagrams for "information superhighway": Enormous hairy pig with fan A rough whimper of insanity
Technical Details
Message-ID:
<40958l$gqc@hermes.synopsys.com>Path:
arc1-ca.pugleaf.net!news.synopsys.com!jbuckReferences:
<3vpmv5$4t7@mujibur.inmind.com> <4023ic$sss@lyman.pppl.gov> <404gjm$bhu@mujibur.inmind.com> <MATT.95Aug7100148@godzilla.eecs.berkeley.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!news.synopsys.com!jbuck From: jbuck@synopsys.com (Joe Buck) Newsgroups: comp.std.c++ Subject: Re: STL operators != > <= >= Date: 9 Aug 1995 02:07:17 GMT Organization: Synopsys Inc., Mountain View, CA 94043-4033 Message-ID: <40958l$gqc@hermes.synopsys.com> References: <3vpmv5$4t7@mujibur.inmind.com> <4023ic$sss@lyman.pppl.gov> <404gjm$bhu@mujibur.inmind.com> <MATT.95Aug7100148@godzilla.eecs.berkeley.edu> NNTP-Posting-Host: deerslayer.synopsys.com