Boost logo

Boost :

From: Daniel Frey (daniel.frey_at_[hidden])
Date: 2001-08-17 08:11:22


Peter Dimov wrote:
>
> 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.

It depends on the point of view, as the function given chains the calls
to other implementations of less<> that finally have to call operator<,
so in the end the resulting operation executed will conform to the
standard. But I see that this is a problem for the lawyers, not for the
technicians, and I'm certainly not a lawyer :) Quite unsatisfying for
me, but this is one of the cases where I will continue to break the
standard as it is IMHO too restricting here. Still not an option for
boost, though...

Regards, Daniel

--
Daniel Frey
aixigo AG - financial training, research and technology
Schloß-Rahe-Straße 15, 52072 Aachen, Germany
fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99
eMail: daniel.frey_at_[hidden], web: http://www.aixigo.de

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