Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-08-17 07:55:00


From: "Daniel Frey" <daniel.frey_at_[hidden]>
> Peter Dimov wrote:
> > // std::less specializations do not help in cases like
> > // map<pair<shared_ptr, int>, int>

> Maybe I don't understand the problem here, but given that less<> is
> defined for the pair's sub-types, a generic less<> for pair could solve
> this problem. Something like this:
>
> namespace std
> {
> template< class First, class Second > struct less< pair< First, Second
> >

Yes, it could. However there is no such specialization in the standard
library, and a conforming program can't add it since it does not depend on
an UDT.

The standard library simply isn't designed that way. less<> means operator<.
Making less<> mean something else requires a redesign.

--
Peter Dimov
Multi Media Ltd.

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