From 490d24f1af571df231a9c0cbab553f0c5feb1bd8 Mon Sep 17 00:00:00 2001
From: Felix Weiglhofer <weiglhofer@fias.uni-frankfurt.de>
Date: Tue, 20 Jun 2023 08:50:39 +0000
Subject: [PATCH] algo: Use feature-test macro to check if stl parallel
 algorithms are available.

---
 algo/base/BuildInfo.h        | 4 ++--
 algo/base/compat/Algorithm.h | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/algo/base/BuildInfo.h b/algo/base/BuildInfo.h
index ddfe4bb44d..5eba468404 100644
--- a/algo/base/BuildInfo.h
+++ b/algo/base/BuildInfo.h
@@ -13,8 +13,8 @@ namespace cbm::algo::BuildInfo
   extern const std::string BUILD_TYPE;
   extern const bool GPU_DEBUG;
 
-  inline constexpr bool HAVE_TBB =
-#ifdef WITH_TBB
+  inline constexpr bool WITH_TBB =
+#ifdef HAVE_TBB
     true;
 #else
     false;
diff --git a/algo/base/compat/Algorithm.h b/algo/base/compat/Algorithm.h
index 378cc57582..5aef2404f7 100644
--- a/algo/base/compat/Algorithm.h
+++ b/algo/base/compat/Algorithm.h
@@ -16,7 +16,7 @@
 **/
 
 #include <algorithm>
-#if __has_include(<execution>)
+#ifdef __cpp_lib_execution
 #define WITH_EXECUTION
 #include <execution>
 #endif
@@ -28,11 +28,11 @@ namespace cbm::algo
   {
 #ifdef WITH_EXECUTION
     inline constexpr auto ExecPolicy =
-#ifdef HAVE_TBB
+#if defined(__cpp_lib_parallel_algorithm) && defined(HAVE_TBB)
       std::execution::par_unseq;
 #else
       std::execution::seq;
-#endif  // HAVE_TBB
+#endif  // __cpp_lib_parallel_algorithm && WITH_TBB
 #endif  // WITH_EXECUTION
   }  // namespace detail
 
-- 
GitLab