Simple generic parallelism idiom & C++17 specifics

from blog Bert Hubert's writings, | ↗ original
If you programmed something and it turns out to be too slow, often you’d like to farm out the work to multiple threads. At this point you typically have a few choices: use some kind of producer/consumer pipe half-ass it by dividing the work into n chunks and launch n threads and hope for the best rely on one of the magic parallelization solutions...