
AMDG Robert Jones wrote:
On Wed, Jul 14, 2010 at 7:30 PM, Steven Watanabe
wrote: boost::bind( wrapper, a, boost::bind( c, p ), b ); creates a function object that executes wrapper(a, c(p), b). what you want is wrapper(a, boost::bind( c, p ), b), so you have to write boost::bind( wrapper, a, boost::protect(boost::bind( c, p )), b );
I know I'm being really dim here, but I have a strange mental block about protect, so for the hard-of-thinking can you explain the difference between
boost::bind( wrapper, a, boost::bind( c, p ), b );
and
boost::bind( wrapper, a, boost::protect(boost::bind( c, p )), b );
The usual behavior of nested binds is to evaluate them all at once like: wrapper(a, c(p), b). Note that this means that when evaluating a bind, we first recurse into all nested binds. protect prevents this. A bind object that has been protected is treated like any other argument giving: wrapper(a, boost::protect(boost::bind( c, p )), b) In Christ, Steven Watanabe