Skip to content

Commit

Permalink
Changed order of parallel_for_nowait and parallel_for to fix compilat…
Browse files Browse the repository at this point in the history
…ion issues under linux
  • Loading branch information
ThomasRahm committed May 30, 2022
1 parent 07e92a3 commit 5d684ce
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/utils/algorithm.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,6 @@ std::vector<size_t> order(const std::vector<T> &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<typename T>
void parallel_for(T from, T to, T increment, const std::function<void(const T)>& body)
{
parallel_for_nowait<T>(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.
Expand Down Expand Up @@ -101,6 +85,22 @@ std::future<void> 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<typename T>
void parallel_for(T from, T to, T increment, const std::function<void(const T)>& body)
{
parallel_for_nowait<T>(from,to,increment,body).wait();
}



} // namespace cura

Expand Down

0 comments on commit 5d684ce

Please sign in to comment.