
28 Dec
2007
28 Dec
'07
6:34 p.m.
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.