boost::thread_group in C++11?

AbuBakr picture AbuBakr · Mar 27, 2012 · Viewed 10.9k times · Source

Is there anything like boost::thread_group in C++11?

I'm just trying to port my program from using boost:thread to C++11 threads and wasn't able to find anything equivalent.

Answer

Anthony Williams picture Anthony Williams · Mar 27, 2012

No, there's nothing directly equivalent to boost::thread_group in C++11. You could use a std::vector<std::thread> if all you want is a container. You can then use either the new for syntax or std::for_each to call join() on each element, or whatever.