diff --git a/src/utils/algorithm.h b/src/utils/algorithm.h index 9f47e90a24..2d0549dacb 100644 --- a/src/utils/algorithm.h +++ b/src/utils/algorithm.h @@ -46,22 +46,6 @@ std::vector order(const std::vector &in) } - -/* An implementation of parallel for. - * There are still a lot of compilers that claim to be fully C++17 compatible, but don't implement the Parallel Execution TS of the accompanying standard library. - * This means that we mostly have to fall back to the things that C++11/14 provide when it comes to threading/parallelism/etc. - * - * \param from The index starts here (inclusive). - * \param to The index ends here (not inclusive). - * \param increment Add this to the index each time. - * \param body The loop-body, as a closure. Receives the index on invocation. - */ -template -void parallel_for(T from, T to, T increment, const std::function& body) -{ - parallel_for_nowait(from,to,increment,body).wait(); -} - /* An implementation of parallel for nowait. * There are still a lot of compilers that claim to be fully C++17 compatible, but don't implement the Parallel Execution TS of the accompanying standard library. * This means that we mostly have to fall back to the things that C++11/14 provide when it comes to threading/parallelism/etc. @@ -101,6 +85,22 @@ std::future parallel_for_nowait(T from, T to, T increment, const std::func return ret; } +/* An implementation of parallel for. + * There are still a lot of compilers that claim to be fully C++17 compatible, but don't implement the Parallel Execution TS of the accompanying standard library. + * This means that we mostly have to fall back to the things that C++11/14 provide when it comes to threading/parallelism/etc. + * + * \param from The index starts here (inclusive). + * \param to The index ends here (not inclusive). + * \param increment Add this to the index each time. + * \param body The loop-body, as a closure. Receives the index on invocation. + */ +template +void parallel_for(T from, T to, T increment, const std::function& body) +{ + parallel_for_nowait(from,to,increment,body).wait(); +} + + } // namespace cura