Hi
Is it possible to pass variadic template arguments to bind, such that bind
uses them as the placeholder arguments (_1, _2, _3 etc)
I show my use case below.
struct job_queue
{
// copy f into list for asynchronous envocation by another thread
void enqueue(boost::function f);
};
//-----------------------------------------------------------------------
// helper class to define correct form of the member function callback
template struct cb { typedef void
(T::*type)(Args...); };
// a job defines a callback function which is any member function taking any
number of arguments of any type
template
class job_t
{
boost::shared_ptr queue;
boost::function arg_func;
public:
job_t(typename cb::type cb, boost::shared_ptr<T> that,
boost::shared_ptr q) :
arg_func(boost::bind(cb, that, Args...)), queue(q) {} // normally
would be _1, _2, _3, etc
void post(Args&... args)
{
boost::function f = boost::bind(arg_func, args...);
queue->enqueue(f);
}
};