
AMDG Serguei Kolos wrote:
I'm wondering why the attached code which is using nested boost::bind() does not compile on GCC ( I have tried 4.1 and 4.3). According to the "bind" package documentation nested bind() calls are allowed. To make it compile (and work!) it's necessary to add explicit cast to the result of the nested bind() call, like:
boost::function
f = boost::bind( wrapper, a, (boost::function )boost::bind( cb, p ), b ); But that is something which I don't like. Any ideas?
Use boost::protect. The problem is that nested binds are handled specially: 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 ); In Christ, Steven Watanabe