Boost logo

Boost Users :

Subject: [Boost-users] problems with boost bind and boost thread
From: Marco (marco.schumann_at_[hidden])
Date: 2012-03-22 04:56:32


Hi,

I have problems with the attached code (test.cpp, extracted from the
original class only with the relevant code).
The member template constructor of CCycleThread takes an argument and
passes this to boost bind. The binding is to a another member template
method which is the thread function for boost thread:

boost::thread(boost::bind(&CCycleThread::execute<T>,this,t)

The template parameter type is deduced by the argument type passed by
the user.

If the type is an ordinary function the code works fine. If the argument
itself is another boost bind object the compilation fails!

I tested the following within the constructor:

auto test = boost::bind(&CCycleThread::execute<T>,this,t) // -> ok
test(); // -> compile error

The call of the operator() of the bind object is the problem.

Interestingly, if one binding is boost::bind and the other one is
std::bind the code works.
Any ideas what's the problem? How can I fix this? Using std and boost
bind is more a hack than a real solution :/





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