Parallelize eraser

This commit is contained in:
Yousef Khadadeh 2026-05-29 23:14:56 +03:00
parent 4363fe9f9d
commit 4c4c767eef
5 changed files with 36 additions and 13 deletions

View file

@ -33,3 +33,14 @@ template <typename ContainerType> void parallel_loop_container(const ContainerTy
std::for_each(std::execution::par_unseq, c.begin(), c.end(), func);
#endif
}
template <typename ContainerType> void parallel_loop_container_mutable(ContainerType& c, std::function<void(typename ContainerType::value_type&)> func, bool forceSingleThread = false) {
#if defined(__EMSCRIPTEN__) || defined(__ANDROID__)
std::for_each(c.begin(), c.end(), func);
#else
if(forceSingleThread)
std::for_each(c.begin(), c.end(), func);
else
std::for_each(std::execution::par_unseq, c.begin(), c.end(), func);
#endif
}