Boost logo

Boost :

From: Braden N. McDaniel (braden_at_[hidden])
Date: 2000-02-28 00:17:42


On Sun, 27 Feb 2000, Joe Gottman wrote:

> > On Sun, 27 Feb 2000, Kevlin Henney wrote:
> >
> > > "For templates greater, less, greater_equal, and less_equal, the
> > > specializations for any pointer type yield a total order, even if the
> > > built-in operators <, >, <=, >= do not." [20.3.3 para 8]
> >
> > Okay, silly question time: What exactly is meant here by the term "total
> > order"?
>
> An ordering relation such that for every pair of elements x and y,
> exactly one of the following statements is true: x < y, x == y, x > y.

Thanks.

Kevlin: I think I see your point. But while it's true that the particulars
the ordering implied by operator< are almost certainly uninteresting, this
really isn't the point. I think it may be useful for a containter to be
keyed on a shared_ptr: for some uses of std::set and std::map, the order
of the elements may be uninteresting to the user; rather, the use of these
containers may be motivated by other features.

It is certainly true that one can create one's own comparator (either a
specialization of std::less or something original). However, having
operator< available to suit the default case seems like a useful
convenience.

-- 
Braden N. McDaniel
braden_at_[hidden]
<URL:http://www.endoframe.com>

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