Boost logo

Boost Users :

From: James Sutherland (James.Sutherland_at_[hidden])
Date: 2008-07-07 19:48:01


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;
}


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