Extracting Data from Threads
There you are designing a parallel algorithm, and then it occurs to you: How do I return information to the main thread from a child thread?
If you’ve skimmed through half of The C++ Programming Language (4th Edition) by Bjarne Stroustrup like I have, you may recall a section about futures and promises which are related to threads.
Well those are exactly what we need, although I am sure you could create a custom solution. Like perhaps locking and inserting your data into an external container. Perhaps you prefer a standard C++ answer to your problems though? This way it makes sense and you need less comments.
My case was that I wished to learn the “proper” way to do it, and boy did I have a time learning.