Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:54:05

0001 
0002 //              Copyright Catch2 Authors
0003 // Distributed under the Boost Software License, Version 1.0.
0004 //   (See accompanying file LICENSE.txt or copy at
0005 //        https://www.boost.org/LICENSE_1_0.txt)
0006 
0007 // SPDX-License-Identifier: BSL-1.0
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     // std::result_of is deprecated in C++17 and removed in C++20. Hence, it is
0033     // replaced with std::invoke_result here.
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 } // namespace Catch
0042 
0043 namespace mpl_{
0044     struct na;
0045 }
0046 
0047 #endif // CATCH_META_HPP_INCLUDED