Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-07-14 14:41:53

Arash Partow wrote:
> Hi Peter,
> thanks for your help, I'm one step closer to what I've been trying
> to accomplish and that is to be able use bind's within threads,
> the problem it seems is that bind doesn't like classes that implement
> the noncopyable interface.


> boost::thread_group thrd_grp;
> std::for_each(list.begin(),
> list.end(),
> boost::bind(&boost::thread_group::create_thread, thrd_grp,

By default boost::bind makes a copy of its arguments, but you can use
boost::ref to make it store a reference to thrd_grp instead:


Since create_thread is a member function, a pointer to thrd_grp will work,

          boost::bind(&boost::thread_group::create_thread, &thrd_grp,

> boost::bind(&do_something, boost::bind(select<param_set,0>(),_1),
> boost::bind(select<param_set,1>(),_1))));

Boost list run by bdawes at, gregod at, cpdaniel at, john at