From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-07-11 18:41:55


David Abrahams wrote:
> "Peter Dimov" <pdimov_at_[hidden]> writes:
>
>> Sean Parent wrote:
>>
>>>> This could have been avoided by defining a separate relation for
>>>> set/map
>>>> order, either as a function reachable via ADL, or as a function
>>>> object, then
>>>> making sure that it is defined for all standard value types.
>>
>>> Why is this necessary? std::less<> serves us well and avoids the
>>> whole ADL mess.
>>
>> std::less is ambiguous. It could be that you wanted merely the
>> function object representation of operator<, or it could be that you
>> wanted the default map/set ordering relation. It is not clear which
>> of the two std::less is supposed to be.
>
> If shared_ptr doesn't support operator< it's not a problem, is it?

The context is:

- If we had a separate relation for set/map we would use that for
settable/mappable objects.
- Why is a separate relation better than just using less<>?
- Because it is evident from the design of the standard library that less<>
isn't meant for that, not consciously, at least.

"What should shared_ptr do" is a separate question. Under the current status
quo, it defines operator< to order pair< shared_ptr<>, int > as well. Under
a revised standard, it may well need to do something else, depending on how
the standard is changed.