Marc Viala wrote:
Hi,
I would like to know how I can use boost::bind with template function member?
To explain my problem, you will find hereafter an example code that demonstrates it. In this code, when we try to bind the function member X::g the compiler failed with tons of error message.
Am I doing something wrong?
Best regards,
Marc Viala mailto:mviala@acticm.com
----------------------------------- Platform: VC++ 7.1 Boost 1.33.1
----------------------------------- #include
#include struct X { template
void g(A& a, B& b) { std::cout << a << " " << b << '\n' ; } void f(int& i) { std::cout << i << '\n'; } } ;
template
void e(A& a, B& b) { std::cout << a << " " << b << '\n' ; } int main(int argc, char* argv[]) { int a = 10, b = 11 ; X x ; boost::function
pe = boost::bind(&e , a, b) ; // <- OK pe() ; boost::function pg = boost::bind(&X::g , &x, a, b) ; // <- Don't compile?
Try... = boost::bind((void(X::*)(int,int))&X::g,&x,a,b) -- -- Grafik - Don't Assume Anything -- Redshift Software, Inc. - http://redshift-software.com -- rrivera/acm.org - grafik/redshift-software.com -- 102708583/icq - grafikrobot/aim - Grafik/jabber.org