
27 Mar
2012
27 Mar
'12
2:46 p.m.
I thought its purpose was allow binding, but not evaluating, of a function object.
...when passed to bind() as a not first argument.
So that this should work.
#include <iostream> #include
#include void f( int i ) { std::cout << i << std::endl; }
template <typename NullaryCallable> void g( const NullaryCallable & callable ) { callable( ); }
int main( ) { g( protect( bind( f, _1 ) )( 1 ) ); }
But it doesn't, and instead thinks I'm calling g() with the return type of f(), just as if I'd not used protect at all.
Sure, protect doesn't do anything here.
Is it possible to have bind generate a fully bound, nullary callable object?
bind(f, 1);