Boost logo

Boost Users :

From: James Sutherland (James.Sutherland_at_[hidden])
Date: 2008-07-07 16:43:16


The following code does not compile:

struct X {
   int foo(int i) { return ++i; }
   template<class T> void foo( T& t );
};

int main()
{
   boost::function<int(int)> f;
   X x;
   f = boost::bind( &X::foo, &x );
   std::cout << f(5) << std::endl;
}

I get the error message "no matching function for call to
‘bind(<unknown type>, X*)"

If I remove the "template<class T> void foo" method then it compiles
fine.

Is there a way to tell boost::bind to choose the int foo(int i) method
rather than the "template<class T> void foo" method?

James


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