9 Jan
2003
9 Jan
'03
7:16 p.m.
From: "Duane Murphy"
I am trying to use bind() with std::not1() (I think this is what I want to do :-). But std::not1() gets a compiler error because bind doesnt have an argument_type typedef.
bool is_something( int x, int y ) { return something( x, y ); }
{ ... if ( std::not1( boost::bind( is_something, 3, _1 ) ) ) { // not something } }
Am I approaching this incorrectly? Does bind support argument_type?
No, bind does not support argument_type. You can pass anything to bind(is_something, 3, _1) and bind will forward it to is_something; it doesn't have a fixed argument type. You can use bind(logical_not<bool>(), bind(is_something, 3, _1)) although I admit that it's not as concise as the not1 version.