I noticed that a majority (if not all) functions in <algorithm>
are getting one or more extra overloads. All of these extra overloads add a specific new parameter, for example, std::for_each
goes from:
template< class InputIt, class UnaryFunction >
UnaryFunction for_each( InputIt first, InputIt last, UnaryFunction f );
to:
template< class ExecutionPolicy, class InputIt, class UnaryFunction2 >
void for_each( ExecutionPolicy&& policy, InputIt first, InputIt last, UnaryFunction2 f );
What effect does this extra ExecutionPolicy
have on these functions?
What are the differences between:
std::execution::seq
std::execution::par
std::execution::par_unseq
And when to use one or the other?
question from:
https://stackoverflow.com/questions/39954678/difference-between-execution-policies-and-when-to-use-them 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…