1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef TEST_SUPPORT_TEST_EXECUTION_POLICIES
10 #define TEST_SUPPORT_TEST_EXECUTION_POLICIES
15 #include <type_traits>
18 #include "test_macros.h"
20 #define EXECUTION_POLICY_SFINAE_TEST(function) \
21 template <class, class...> \
22 struct sfinae_test_##function##_impl : std::true_type {}; \
24 template <class... Args> \
25 struct sfinae_test_##function##_impl<std::void_t<decltype(std::function(std::declval<Args>()...))>, Args...> \
26 : std::false_type {}; \
28 template <class... Args> \
29 constexpr bool sfinae_test_##function = sfinae_test_##function##_impl<void, Args...>::value;
31 template <class Functor
>
32 bool test_execution_policies(Functor func
) {
33 func(std::execution::seq
);
34 #if TEST_STD_VER >= 20
35 func(std::execution::unseq
);
37 func(std::execution::par
);
38 func(std::execution::par_unseq
);
43 template <template <class Iter
> class TestClass
>
44 struct TestIteratorWithPolicies
{
47 test_execution_policies(TestClass
<Iter
>{});
54 Bool(bool b
) : b_(b
) {}
61 [[noreturn
]] inline void terminate_successful() { std::exit(0); }
63 #endif // TEST_SUPPORT_TEST_EXECUTION_POLICIES