Question:
I have this code:Answer:
Using C++17’s fold expressions you may forward execution of several processes to the common “process singleP
” implementation:processSingle()
is simple you could skip implementing it in a separate function and instead place all of it within the fold expression, as shown in @Jarod42’s answer.If you have better answer, please add a comment about this, thank you!