Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:40:40

0001 //  Copyright Matt Borland 2021.
0002 //  Use, modification and distribution are subject to the
0003 //  Boost Software License, Version 1.0. (See accompanying file
0004 //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0005 //
0006 //  https://en.cppreference.com/w/cpp/experimental/is_detected
0007 
0008 #ifndef BOOST_MATH_TOOLS_IS_DETECTED_HPP
0009 #define BOOST_MATH_TOOLS_IS_DETECTED_HPP
0010 
0011 #include <type_traits>
0012 
0013 namespace boost { namespace math { namespace tools {
0014 
0015 template <typename...>
0016 using void_t = void;
0017 
0018 namespace detail {
0019 
0020 template <typename Default, typename AlwaysVoid, template<typename...> class Op, typename... Args>
0021 struct detector
0022 {
0023     using value_t = std::false_type;
0024     using type = Default;
0025 };
0026 
0027 template <typename Default, template<typename...> class Op, typename... Args>
0028 struct detector<Default, void_t<Op<Args...>>, Op, Args...>
0029 {
0030     using value_t = std::true_type;
0031     using type = Op<Args...>;
0032 };
0033 
0034 } // Namespace detail
0035 
0036 // Special type to indicate detection failure
0037 struct nonesuch
0038 {
0039     nonesuch() = delete;
0040     ~nonesuch() = delete;
0041     nonesuch(const nonesuch&) = delete;
0042     void operator=(const nonesuch&) = delete;
0043 };
0044 
0045 template <template<typename...> class Op, typename... Args>
0046 using is_detected = typename detail::detector<nonesuch, void, Op, Args...>::value_t;
0047 
0048 template <template<typename...> class Op, typename... Args>
0049 using detected_t = typename detail::detector<nonesuch, void, Op, Args...>::type;
0050 
0051 template <typename Default, template<typename...> class Op, typename... Args>
0052 using detected_or = detail::detector<Default, void, Op, Args...>;
0053 
0054 }}} // Namespaces boost math tools
0055 
0056 #endif // BOOST_MATH_TOOLS_IS_DETECTED_HPP