-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
60 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#pragma once | ||
|
||
#include <execution> | ||
|
||
namespace OpenVic { | ||
template <class InputIt, class UnaryFunc> | ||
inline constexpr void try_parallel_for_each( | ||
InputIt first, | ||
InputIt last, | ||
UnaryFunc f | ||
) { | ||
#ifdef __cpp_lib_execution | ||
if constexpr (__cpp_lib_execution >= 201603L) { | ||
std::for_each(std::execution::par, first, last, f); | ||
} else { | ||
std::for_each(first, last, f); | ||
} | ||
#else | ||
std::for_each(first, last, f); | ||
#endif | ||
} | ||
} |