Parallelize eraser
This commit is contained in:
parent
4363fe9f9d
commit
4c4c767eef
5 changed files with 36 additions and 13 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue