Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2007-12-28 13:34:24


Xiaofan Li:

...

> for (int i = 0; i < 10; ++i)
> threads.create_thread( boost::bind( boost::mem_fn(
> &threaded::increment_count ), &_thrd, a ) );

Use

    boost::bind( &threaded::increment_count, &_thrd, boost::ref( a ) )

to make boost::bind store a reference to 'a', rather than a copy.


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