Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2001-05-27 10:32:16


----- Original Message -----
From: "John Max Skaller" <skaller_at_[hidden]>

> > On first sight I'd say Peter may have uncovered a defect in the
standard. I
> > don't think we meant to say that about std::less<>.
>
> The intended requirement is that, where < is defined
> by the Standard, it must agree with less<>. In particular,
> if two pointers a,b point into the same array, then
>
> assert(a < b == less(a,b))
>
> On the other hand, the result of a<b isn't well defined
> otherwise, so the above assertion need not be the case.
>
> less<> was introduced _solely_ to provide
> a total ordering on pointers, since < cannot be
> relied upon to provide one. It is necessary
> to create STL sets (etc) of pointers.

Hmm, now I'm persuaded to agree with Mr. Skaller...
Who would expect

   std::find_if(a, b, std::bind2nd(
        std::less<boost::shared_ptr<int> >(), boost::shared_ptr<int>()));

to work when operator<() is not defined for boost::shared_ptr<>?

-Dave


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