Boost logo

Boost :

From: Dave Harris (brangdon_at_[hidden])
Date: 2002-08-06 16:02:26


In-Reply-To: <4.3.1.2.20020805090951.03730a48_at_[hidden]>
On Mon, 05 Aug 2002 09:25:03 -0700 Victor A. Wagner, Jr.
(vawjr_at_[hidden]) wrote:
> If there are people who see some "lexicographic" ordering to the
> elements of a set, then we've got some differences to address. From my
> point of view, all the elements in a set are of "equal importance" and
> the < and operators should return the same results independent of
> the underlying implementation.
>
> With that in mind, it appears that one could simply have operator <=()
> (and >=() with the args reversed) call is_subset_of() and have operator
> <() (>() ditto above) call is_proper_subset().

Some kind of total ordering can be handy when using STD algorithms and
containers which expect it. For example, std::map (or std::set for that
matter). In this situation we don't much care what the order actually is.
We are using it as the moral equivalent of a hash() function. So it can
depend on the implementation. A lexical ordering will do.
is_proper_subset() won't, because it is not a total order.

That is an argument for something like lexical_order(), or perhaps less().
I suppose you could still have operator<() map to is_proper_subset(), but
I would find that surprising.

-- Dave Harris


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