std::thread* myThread = new std::thread[n]; for (int i = 0; i < n; i++) { myThreads[i] = std::thread(exec, i); }
#include <thread> void foo() { // do stuff... } int main() { std::thread first (foo); first.join(); }