
17 Jun
2010
17 Jun
'10
1:12 a.m.
AMDG Nathan Ridge wrote:
I'm getting some compiler errors with boost::bind that I'm not able to figure out.
I was able to reduce it to the following minimal example:
#include
using boost::bind;
template <typename RawProc> void AdapterProc(RawProc proc) { // do other stuff, then call proc() }
template <typename RawProc> void f(RawProc proc) { bind(&AdapterProc<RawProc>, proc)(); }
void RawProc(int x);
int main() { f(bind(&RawProc, 0)); }
This resolves to bind(&AdapterProc<RawProc>, bind(&RawProc, 0))(). Nested binds are handled specially, so this is evaluated as AdapterProc(RawProc(0)) you need to wrap proc with boost::protect (from boost/bind/protect.hpp) in f. In Christ, Steven Watanabe