Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2006-07-19 08:02:29


Daryle Walker <darylew_at_[hidden]> writes:

> On 7/11/06 11:51 AM, "David Abrahams" <dave_at_[hidden]> wrote:
>
>> "Philippe Vaucher" <philippe.vaucher_at_[hidden]> writes:
>>
>>>>
>>>> How do you make a std::set of structs, pairs, or tuples?
>>>>
>>>
>>> Maybe it was already said (didn't read the whole thread), but I thought I'd
>>> add my 0.02$.
>>>
>>> I think we should not define meaningless operator< for the structs/whatever,
>>> and let the user define one if he wants to use those structs in a set.
>>
>> That would be exceedingly inconvenient. Having a builtin operator<
>> for tuples is a huge win for users.
>
> But should a convenient lie (providing fake operators "<" to use in sets &
> maps) trump an inconvenient truth (not providing such operators for types
> that model an unordered concept)? Convenient lies can suddenly turn
> inconvenient at the worst times....

shared_ptr's operator< is neither fake nor is it a lie. The same
applies to operator< for tuples. They are both well-specified and
consistent with the standard's expected requirements for operator<.
Certainly tuple, a heterogeneous container, has an operator< that's
consistent with the ones for std::vector and std::string.

I request that you objectively justify your use of "fake" and "lie"
here, or that you set aside the hyperbolic language and start dealing
with facts.

As far as I can tell these operators have _never_ been shown to cause
any problems other than violating some peoples' sense of purity.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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