From: John Max Skaller (skaller_at_[hidden])
Date: 2001-05-27 09:57:24
David Abrahams wrote:
> ----- Original Message -----
> From: "Darin Adler" <darin_at_[hidden]>
> > not standard-conforming. But I now see that 184.108.40.206p1 specifically says
> > that the specialization must "meet the standard library requirements for
> > the original template", and that in the case of std::less, that means it
> > must have the same result as using the < operator directly.
> 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.
-- John (Max) Skaller, mailto:skaller_at_[hidden] 10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850 checkout Vyper http://Vyper.sourceforge.net download Interscript http://Interscript.sourceforge.net
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk