vector of std::threads vector of std::threads multithreading multithreading

vector of std::threads


Your first example is correct. Throwing an exception is a known bug, when you using clang with libstdc++. To solve it, you have to install libc++(llvm version of c++ library). See an example of compiling with libc++ below

#include <thread>int main(){    std::thread t([] () {});    t.join();    return 0;}

$ clang++ -std=c++11 -stdlib=libc++ main.cpp -o main -lc++ -lsupc++ -lpthread

P.S. See here, why is the flag -lsupc++ required too.