Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2008-05-27 17:01:56

I just discovered that while none of my standard containers are
"move-aware" in the way needed by boost::thread, I can use boost::array
to store threads by simply move-assigning new threads into the elements
it contains:

   boost::array<boost::thread, 100> thread_q;

   for (int i = 0; i < 100; ++i)
       thread_q[i] = boost::thread( some_function );

it ain't perfect, but given that the number of cores on any real machine
is limited these days, you can do a lot with a fixed-size array of
thread. Pretty cool; it sure beats using shared_ptr.

Dave Abrahams
BoostPro Computing

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