I´m building a real time software where I have a main infinite loops on main() and threads used to read and process data.
main()
One of the issues is keeping a
This is guarantee that every thread will be created in vector's storage. No object byte will be copied.
for (int &reader : readers) readerThreads.emplace_back( readerThread::start, reader );
In common case this not the same as @Seth suggested. But in current case it is 99% the same.