
3 Feb
2006
3 Feb
'06
5:19 p.m.
Stephen Gross wrote:
I'm trying to figure out the correct syntax for boost::bind-ing a static member function with some arguments preset. ...
This code works for me: #include <boost/bind.hpp> #include <boost/function.hpp> #include <iostream> struct Foo { static double go(int x, int y) { return x + y; } }; int main() { typedef boost::function<double(int)> functortype; functortype f = boost::bind(&Foo::go, _1, 4); std::cout << f(3) << std::endl; } Hope it helps.