#include #include #include int main() { // example from https://en.cppreference.com/w/cpp/algorithm/execution_policy_tag_t int x = 0; std::mutex m; int a[] = {1, 2}; std::for_each(std::execution::par, std::begin(a), std::end(a), [&](int) { std::lock_guard guard(m); ++x; // correct }); }