|
Boost : |
Subject: Re: [boost] [Review:Algorithms] Order of args to clamp
From: Jeffrey Lee Hellrung, Jr. (jeffrey.hellrung_at_[hidden])
Date: 2011-09-24 15:54:52
On Sat, Sep 24, 2011 at 2:04 AM, John Bytheway <jbytheway+boost_at_[hidden]>wrote:
> On 24/09/11 01:12, Jeffrey Lee Hellrung, Jr. wrote:
> <snip>
> > struct less
> > {
> > typedef bool result_type;
> > template< class T, class U >
> > bool operator()(T const & x, U const & y) const
> > { return x < y; }
> > };
> >
> > for the default comparison function object. I don't think using
> std::less,
> > directly or indirectly, over operator< buys you anything here, does it?
>
> Yes, it does buy you something. std::less defines a total ordering on
> pointers, operator< need not. (See N3290 [comparisons] 20.8.5 p8)
>
Well, then...add an operator() overload for (T*, T*) that forwards to
std::less<T>, I suppose...?
- Jeff
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk