diff --git a/bind.html b/bind.html index 8d965c2..8509531 100644 --- a/bind.html +++ b/bind.html @@ -27,6 +27,7 @@ to members
The header boost/bind/protect.hpp contains an implementation of protect. To protect a bind function object from evaluation, use protect(bind(f, ...)).
+For convenience, the function objects produced by bind overload + the logical not operator ! and the relational operators ==, + !=, <, <=, >, + >=.
+!bind(f, ...) is equivalent to bind( logical_not(), bind(f, + ...) ), where logical_not is a function object that + takes one argument x and returns !x.
+bind(f, ...) op x, where op is a relational operator, + is equivalent to bind( relation(), bind(f, ...), x ), where relation + is a function object that takes two arguments a and b and + returns a op b.
+What this means in practice is that you can conveniently negate the result of + bind:
+std::remove_if( first, last, !bind( &X::visible, _1 ) ); // remove invisible + objects
+and compare the result of bind against a value:
+std::find_if( first, last, bind( &X::name, _1 ) == "peter" );
+against a placeholder:
+bind( &X::name, _1 ) == _2
+or against another bind expression:
+std::sort( first, last, bind( &X::name, _1 ) < bind( &X::name, _2 ) + ); // sort by name
class image;