Hi All
I'd appreciate some helpful words about Boost.Bind protect, 'cos I'm not quite understanding it!
I thought its purpose was allow binding, but not evaluating, of a function object. So that this should
work.
#include <iostream>
#include <boost/bind.hpp>
#include <boost/bind/protect.hpp>
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.
Is it possible to have bind generate a fully bound, nullary callable object?
TIA,
- Rob.