Boost logo

Boost :

From: Victor A. Wagner, Jr. (vawjr_at_[hidden])
Date: 2002-08-07 20:53:01

At Tuesday 2002/08/06 14:02, you wrote:
>In-Reply-To: <[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.

are you suggesting that you wish to write set<set<something> > and
therefore set must implement < in a strict ordering sense?

I tried writing a small comparison of std::set, std::bitset, and
dynamic_bitset but ran into problems
apparently my STL (dinkumware) doesn't implement operator < for std::bitset
and my compiler ( gets errors trying to compile a comparison of

for std::set the following line (std and std1 are std::bitset):
         cout << boolalpha << "std.size() > std1.size(): " << (std.size() >
std1.size()) << "; std < std1: " << (std < std1) << endl;
         std.size() > std1.size(): true; std < std1: true

which, of course, can't happen in a math set (if you take size() to be the
same as cardinality).

>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.

I guess the folks making up names for the standard containers weren't
thinking of mathematical sets (and clearly not Pascal set). Given this,
and that at least one person would find it unsurprising that a larger set
compares < to another, means I should just give it up as a bad idea.

>-- Dave Harris
>Unsubscribe & other changes:

Victor A. Wagner Jr.
PGP RSA fingerprint = 4D20 EBF6 0101 B069 3817 8DBF C846 E47A
PGP D-H fingerprint = 98BC 65E3 1A19 43EC 3908 65B9 F755 E6F4 63BB 9D93
The five most dangerous words in the English language:
               "There oughta be a law"

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