
7 Jul
2008
7 Jul
'08
5:48 p.m.
Steve, You are right. In the mean time, I had made a subtle change to the functions. I am on Mac OS X, gcc 4.0.1. How about this (make functions const): #include <boost/function.hpp> #include <boost/bind.hpp> #include <functional> #include <iostream> struct X { int foo(const int i) const { return i+1; } template<class T> void foo( T& t ) const; }; int main() { boost::function<int(int)> f; X x; f = boost::bind(static_cast<int(X::*)(int)>(&X::foo), &x, _1); std::cout << f(5) << std::endl; }