
30 Aug
2006
30 Aug
'06
10:30 p.m.
I'm sure I'm missing something pretty fundamental here. I'm trying to set a boost::function to a member function without any parameters. The following code fails to build (using VS 2005, haven't tested anything else). If I set it to a non-member function it works fine. #include <functional> #include <boost/function.hpp> class test { public: int GetInt() { return 1; } }; int _tmain(int argc, _TCHAR* argv[]) { test inst; boost::function<int ()> getter; // Getting several errors where it appears that <int ()> isn't being handled // as a signature when being handled by mem_fun. Not sure whether that is related. getter = std::bind1st( std::mem_fun(&test::GetInt), &inst); return 0; }