Improved undo

This commit is contained in:
Yousef Khadadeh 2025-07-27 16:30:45 +03:00
parent 7e69688ca6
commit f606fc6fc1
12 changed files with 96 additions and 99 deletions

View file

@ -5,10 +5,13 @@
#include <poolstl.hpp>
#endif
template <typename ContainerType> void parallel_loop_container(const ContainerType& c, std::function<void(const typename ContainerType::value_type&)> func) {
template <typename ContainerType> void parallel_loop_container(const ContainerType& c, std::function<void(const typename ContainerType::value_type&)> func, bool forceSingleThread = false) {
#ifdef __EMSCRIPTEN__
std::for_each(c.begin(), c.end(), func);
#else
std::for_each(std::execution::par_unseq, c.begin(), c.end(), func);
if(forceSingleThread)
std::for_each(c.begin(), c.end(), func);
else
std::for_each(std::execution::par_unseq, c.begin(), c.end(), func);
#endif
}