File indexing completed on 2025-01-18 09:54:05
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef CATCH_META_HPP_INCLUDED
0009 #define CATCH_META_HPP_INCLUDED
0010
0011 #include <type_traits>
0012
0013 namespace Catch {
0014 template <typename>
0015 struct true_given : std::true_type {};
0016
0017 struct is_callable_tester {
0018 template <typename Fun, typename... Args>
0019 static true_given<decltype(std::declval<Fun>()(std::declval<Args>()...))> test(int);
0020 template <typename...>
0021 static std::false_type test(...);
0022 };
0023
0024 template <typename T>
0025 struct is_callable;
0026
0027 template <typename Fun, typename... Args>
0028 struct is_callable<Fun(Args...)> : decltype(is_callable_tester::test<Fun, Args...>(0)) {};
0029
0030
0031 #if defined(__cpp_lib_is_invocable) && __cpp_lib_is_invocable >= 201703
0032
0033
0034 template <typename Func, typename... U>
0035 using FunctionReturnType = std::remove_reference_t<std::remove_cv_t<std::invoke_result_t<Func, U...>>>;
0036 #else
0037 template <typename Func, typename... U>
0038 using FunctionReturnType = std::remove_reference_t<std::remove_cv_t<std::result_of_t<Func(U...)>>>;
0039 #endif
0040
0041 }
0042
0043 namespace mpl_{
0044 struct na;
0045 }
0046
0047 #endif