Boost logo

Boost :

From: George A. Heintzelman (georgeh_at_[hidden])
Date: 2002-09-05 16:53:02

> How would you define the mid-point relation for elements having
> identical midpoints, but varying extension, such as [1, 5] and [2, 4]?
> Since we want a total ordering, and not be forced (through the
> "equivalent if incomparable" hypothesis of the STL library) to have them
> be equal...

The midpoint relation isn't a total ordering. It *is*, however, a
strict weak ordering, which satisfies the requirements for defined
behavior in std::sort. [1,5] and [2,4] are part of the same equivalence
class for this ordering.

If you wanted to extend this to a total ordering, you could, but I
don't think it's necessary, and would add overhead to operator<.
Furthermore, I don't think there is an intuitive definition to choose
in this case, so it will be one of those things that people are
continually looking up.

George Heintzelman

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