Boost logo

Boost Users :

From: raulh39_at_[hidden]
Date: 2006-02-03 12:19:33


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.

 


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net