
7 Jul
2008
7 Jul
'08
2:43 p.m.
The following code does not compile: struct X { int foo(int i) { return ++i; } template<class T> void foo( T& t ); }; int main() { boost::function<int(int)> f; X x; f = boost::bind( &X::foo, &x ); std::cout << f(5) << std::endl; } I get the error message "no matching function for call to ‘bind(<unknown type>, X*)" If I remove the "template<class T> void foo" method then it compiles fine. Is there a way to tell boost::bind to choose the int foo(int i) method rather than the "template<class T> void foo" method? James