Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2000-10-25 14:43:37


Valentin Bonnard has proposed something like this in the past. He even had
the correct mathematical name for it ("partially_ordered<>", I think). You
might search the past message archives for references.

-Dave
----- Original Message -----
From: "Daryle Walker" <darylew_at_[hidden]>
To: "Boost" <boost_at_[hidden]>
Sent: Wednesday, October 25, 2000 3:00 PM
Subject: [boost] Thought on relating comparison operators

> The relation operator classes (like less_than_comparable) in
> "operators.hpp," and the standard assume that:
>
> x != y maps to !(x == y)
> x > y maps to (y < x)
> x <= y maps to !(y < x)
> x >= y maps to !(x < y)
>
> But doesn't this assume that every object of a type can be put into an
> order, so it can be related with every other object? What about types
that
> have object(s) that incomparable with (a subset of) other objects of that
> type? (Example: IEEE 754 floating point NaN values don't compare with
> anything.) The assumed relations won't hold; since all the relations,
> except for inequality, should give false.
>
> Should we have another operator class, similar to the less_than_comparable
> family, that builds the comparisons such that they are safe for this
> problem:
>
> x != y maps to !(x == y)
> x > y maps to (y < x)
> x <= y maps to (x < y) || (x == y)
> x >= y maps to (x > y) || (x == y)
>
> The first two are the same because only the last two have the problem.
>
> --
> Daryle Walker
> Mac, Internet, and Video Game Junkie
> darylew AT mac DOT com
>
>
>
>
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk