|
Boost Users : |
From: Max Motovilov (max_at_[hidden])
Date: 2006-02-16 08:54:21
Dave,
Thanks! Isn't there a problem with equal_range() where both the first
edition of the standard and the work paper you referred to explicitly
mention comp(e,value) and comp(value,e)? That, while consistent with the
behavior of the original STL, seems to still require a symmetrical
predicate...
Regards,
...Max...
"David Abrahams" <dave_at_[hidden]> wrote in message
news:u8xsb4vx7.fsf_at_boost-consulting.com...
> "Max Motovilov" <max_at_[hidden]> writes:
>
> > Now, this:
> >
> > struct less {
> > bool operator()( const Object&, const Key& ) const;
> > bool operator()( const Key&, const Object& ) const;
> > };
> >
> > lower_bound( v.begin(), v.end(), Key(something), less() );
> >
> > should work everywhere, or so I think. Would be nice to be able to
create
> > such an adaptor for a pair of functions (or a pair of bind or lambda
> > expressions for that matter). I blogged a simple solution (for functions
> > only) here
> >
http://swsw.motovilov.net/weblogs/swsw/archives/2006/02/asymmetrical_pr.html
> > but am wondering if perhaps I missed a generic solution in one of the
Boost
> > libraries, or there's one coming in the new release?
>
> Well, standard libraries are now required to make it legal:
>
> http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#270
>
> And you can get an implementation where it works at
>
>
http://www.boost-consulting.com/vault/index.php?&direction=0&order=&directory=Algorithms/binary_search
>
> HTH,
> --
> Dave Abrahams
> Boost Consulting
> www.boost-consulting.com
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net