
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"
"Max Motovilov"
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
HTH, -- Dave Abrahams Boost Consulting www.boost-consulting.com