🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: STL operators != > <= >=

#1714
From: Sam Fenster
Date: Fri, 11 Aug 1995 00:26
24 lines
1991 bytes
> mfinney@inmind.com wrote:
>> The problem is not defined < in terms of > or vice versa, but defined <= in
>> terms of >.  In a linear order there are three possibilities, a < b, a = b
>> or a > b.  In a partial order there are four possibilities, a < b, a = b,
>> a > b or a >< b (using operator >< () mean "not comparable).
>> 
>> For a linear order, a <= b is equivalent to not (a > b).  However, that
>> fails to be true for a partial order because there is an extra possiblity.

Mike Chapman <mchapman@synopsys.com> writes:
> I disagree. If a and b are not ordered (ie not comparable), it is an error
> to try to compare them. Hence a < b (or any of the other 5 operators) are
> free to do whatever they like - throw an exception, return a random value or
> start up a game of tetris.

Wrong.  It is *not* an error to try to compare them.  "Not comparable" just
means that a<b, a==b and a>b are all false.  mfinney has merely defined a new
(non-C++) operator >< that is defined to be true exactly when the other three
are false.  Think of a datatype for which < means, "is an ancestor of."  Or
"is a subset of."

And he's saying that because the STL headers give a template operator > that
(for any type) returns true when <= is false, it screws up comparisons for any
data type that is partially, but not totally (linearly) ordered!
Technical Details
Message-ID: <FENSTER.95Aug10184743@shadow.cs.columbia.edu>
Path: arc1-ca.pugleaf.net!128.32.155.1!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> <408o8u$c0p@hermes.synopsys.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!128.32.155.1!matt
From: fenster@cs.columbia.edu (Sam Fenster)
Newsgroups: comp.std.c++
Subject: Re: STL operators != > <= >=
Date: 11 Aug 1995 00:26:04 GMT
Organization: Columbia University Department of Computer Science
Approved: matt@physics10.Berkeley.EDU (Matt Austern)
Message-ID: <FENSTER.95Aug10184743@shadow.cs.columbia.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>
 <408o8u$c0p@hermes.synopsys.com>
NNTP-Posting-Host: physics10.berkeley.edu