The parallel execution policy, std::execution::par , can be considered the standard execution policy for parallel algorithms. In contrast with the parallel unsequenced policy described later, it handles exceptions, meaning that if an exception is thrown during the execution of the algorithm, the exception will be thrown out back on the main thread and the algorithm will break at an unspecified position:
auto inv_numbers(const std::vector<float>& c, std::vector<float>& out) { out.resize(c.size(), -1.0f); auto inversef = [](float denominator){ if(denominator != 0.0f) { return 1.0f/denominator; } else throw std::runtime_error{"Division by zero};} }; auto p = std::execution::par; std::transform(p, c.begin(), c.end(), out.begin(), ...