🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #1642

Re: STL operators != > <= >=

#1642
From: Matt Austern
Date: Mon, 07 Aug 1995 17:01
28 lines
2248 bytes
In article <404gjm$bhu@mujibur.inmind.com> mfinney@inmind.com writes:

> Interesting example -- and one I had not (yet) considered.  But, of
> course, it is worse than the templated operators are useless.  They
> actively conflict with the correct template definitions.
> 
> BTW, instead of using x @ y to mean non-comparable, I use x  >< y where the
> >< is intended to overlap.  It has the advantage of using the same characters
> as <> so no new symbols are required (I also want to reserve @ for some other
> things, but that is not really relevant here).
> 
> I haven't heard from Koenig or anyone from the the standard on this yet.  I
> hope it isn't too late to get a correction into the standard.

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?  If you have some type Foo for which
the default definitions are wrong, then you can just define
operator>(Foo, Foo) and be done with it.

Is there really any problem here that template specialization doesn't
already solve?
-- 
  Matt Austern                             He showed his lower teeth.  "We 
  matt@physics.berkeley.edu                all have flaws," he said, "and 
  http://dogbert.lbl.gov/~matt             mine is being wicked."
Technical Details
Message-ID: <MATT.95Aug7100148@godzilla.EECS.Berkeley.EDU>
Path: arc1-ca.pugleaf.net!howland.reston.ans.net!agate!agate!matt
References: <3vpmv5$4t7@mujibur.inmind.com> <3vpnrq$50c@mujibur.inmind.com> <3vq030$8v1@lyman.pppl.gov> <3vs00b$4bf@mujibur.inmind.com> <3vtcha$cbv@lyman.pppl.gov> <3vutg6$713@mujibur.inmind.com> <4023ic$sss@lyman.pppl.gov> <404gjm$bhu@mujibur.inmind.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!howland.reston.ans.net!agate!agate!matt
From: matt@godzilla.EECS.Berkeley.EDU (Matt Austern)
Newsgroups: comp.std.c++
Subject: Re: STL operators != > <= >=
Date: 07 Aug 1995 17:01:48 GMT
Organization: University of California at Berkeley (computational neuroscience)
Message-ID: <MATT.95Aug7100148@godzilla.EECS.Berkeley.EDU>
References: <3vpmv5$4t7@mujibur.inmind.com> <3vpnrq$50c@mujibur.inmind.com>
 <3vq030$8v1@lyman.pppl.gov> <3vs00b$4bf@mujibur.inmind.com>
 <3vtcha$cbv@lyman.pppl.gov> <3vutg6$713@mujibur.inmind.com>
 <4023ic$sss@lyman.pppl.gov> <404gjm$bhu@mujibur.inmind.com>
Reply-To: matt@physics.berkeley.edu
NNTP-Posting-Host: godzilla.eecs.berkeley.edu
In-reply-to: mfinney@inmind.com's message of 7 Aug 1995 07:50:14 GMT