Boost logo

Boost :

From: Herve Bronnimann (hbr_at_[hidden])
Date: 2002-09-03 16:00:41

On Tue, Sep 03, 2002 at 04:36:10PM -0400, David Bergman wrote:
> The C++ Standard gives us a default implementation of "<=" in terms of
> "! >". That default behavior should be overridden when that is no longer
> true w.r.t. logic. That is why I used the hard word "wrong", cause it is
> "wrong" as in illogical to have (in a domain with proper equivalence)
> a <= b != a < b || a == b

I assume by a==b you mean the operator==. But the Comparable concept
says nothing about an operator==. It only applies to operators <, >, <=,
and >=.

> Note that The C++ Standard often assumes total orderings in its default
> behavior. A lot of the algorithms provided by The C++ Standard are only
> operable on total orderings. So, by following the default STL behavior
> for this relation will only cause headache further down the road, when
> the user through STL and its algorithms end up with [3, 5] being
> equivalent to [4, 6].

But that is quite all right when `equivalent' means `overlap'.

> Whether logical is "right" or not is another question, so excuse me for
> using the word "wrong"; I should have stuck to illogical.

I will leave the question aside as well, although I feel that neither is
more "logical" than the other. It only depends on one's point of view.

I agree that the comparisons as we provide it are not very suited to the
static analysis or some other domain in which you'd like to apply it,
but that is exactly the point of the comparison policies: you get to
choose what the comparison means to you. I thought wee made the best
choice from that point of view.


Boost list run by bdawes at, gregod at, cpdaniel at, john at