2 // detail/type_traits.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~~
5 // Copyright (c) 2003-2020 Christopher M. Kohlhoff (chris at kohlhoff dot com)
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
11 #ifndef BOOST_ASIO_DETAIL_TYPE_TRAITS_HPP
12 #define BOOST_ASIO_DETAIL_TYPE_TRAITS_HPP
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
18 #include <boost/asio/detail/config.hpp>
20 #if defined(BOOST_ASIO_HAS_STD_TYPE_TRAITS)
21 # include <type_traits>
22 #else // defined(BOOST_ASIO_HAS_STD_TYPE_TRAITS)
23 # include <boost/type_traits/add_const.hpp>
24 # include <boost/type_traits/conditional.hpp>
25 # include <boost/type_traits/decay.hpp>
26 # include <boost/type_traits/integral_constant.hpp>
27 # include <boost/type_traits/is_base_of.hpp>
28 # include <boost/type_traits/is_class.hpp>
29 # include <boost/type_traits/is_const.hpp>
30 # include <boost/type_traits/is_convertible.hpp>
31 # include <boost/type_traits/is_function.hpp>
32 # include <boost/type_traits/is_same.hpp>
33 # include <boost/type_traits/remove_pointer.hpp>
34 # include <boost/type_traits/remove_reference.hpp>
35 # include <boost/utility/declval.hpp>
36 # include <boost/utility/enable_if.hpp>
37 # include <boost/utility/result_of.hpp>
38 #endif // defined(BOOST_ASIO_HAS_STD_TYPE_TRAITS)
43 #if defined(BOOST_ASIO_HAS_STD_TYPE_TRAITS)
45 using std::conditional;
49 using std::false_type;
50 using std::integral_constant;
51 using std::is_base_of;
54 using std::is_convertible;
55 using std::is_function;
57 using std::remove_pointer;
58 using std::remove_reference;
59 #if defined(BOOST_ASIO_HAS_STD_INVOKE_RESULT)
60 template <typename> struct result_of;
61 template <typename F, typename... Args>
62 struct result_of<F(Args...)> : std::invoke_result<F, Args...> {};
63 #else // defined(BOOST_ASIO_HAS_STD_INVOKE_RESULT)
65 #endif // defined(BOOST_ASIO_HAS_STD_INVOKE_RESULT)
67 #else // defined(BOOST_ASIO_HAS_STD_TYPE_TRAITS)
68 using boost::add_const;
69 template <bool Condition, typename Type = void>
70 struct enable_if : boost::enable_if_c<Condition, Type> {};
71 using boost::conditional;
74 using boost::false_type;
75 using boost::integral_constant;
76 using boost::is_base_of;
77 using boost::is_class;
78 using boost::is_const;
79 using boost::is_convertible;
80 using boost::is_function;
82 using boost::remove_pointer;
83 using boost::remove_reference;
84 using boost::result_of;
85 using boost::true_type;
86 #endif // defined(BOOST_ASIO_HAS_STD_TYPE_TRAITS)
91 #endif // BOOST_ASIO_DETAIL_TYPE_TRAITS_HPP