If you want to *negate* the predicate, you can do it with std::not1().
However, for some reason std::not1() can only be called with a function
object, not a function pointer. If you want to use it with a regular
function, you have to do it like std::not1(std::ptr_fun(theFunction)).
But why? Why couldn't std::not1() accept a regular function as parameter?
Because it has to return an object whose type has a couple of nested
typedefs, and their definitions are propagated from the type that you
instantiate it with. A pointer to function doesn't have those typedefs,
so can't be used here. The same problem arises with not2, bind1st and
bind2nd. The solution is to wrap the function pointer in a type that
provides those typedefs, using ptr_fun.
--
Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of
"The Standard C++ Library Extensions: a Tutorial and Reference"
(www.petebecker.com/tr1book)
Why cannot std::not1() do this itself? Why do you have to do it
manually?
It wasn't designed to. ptr_fun was the approach in the original STL.