type_traits.hpp 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. //
  2. // detail/type_traits.hpp
  3. // ~~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
  6. //
  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)
  9. //
  10. #ifndef BOOST_ASIO_DETAIL_TYPE_TRAITS_HPP
  11. #define BOOST_ASIO_DETAIL_TYPE_TRAITS_HPP
  12. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  13. # pragma once
  14. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  15. #include <boost/asio/detail/config.hpp>
  16. #if defined(BOOST_ASIO_HAS_STD_TYPE_TRAITS)
  17. # include <type_traits>
  18. #else // defined(BOOST_ASIO_HAS_TYPE_TRAITS)
  19. # include <boost/type_traits/add_const.hpp>
  20. # include <boost/type_traits/conditional.hpp>
  21. # include <boost/type_traits/decay.hpp>
  22. # include <boost/type_traits/integral_constant.hpp>
  23. # include <boost/type_traits/is_base_of.hpp>
  24. # include <boost/type_traits/is_class.hpp>
  25. # include <boost/type_traits/is_const.hpp>
  26. # include <boost/type_traits/is_convertible.hpp>
  27. # include <boost/type_traits/is_function.hpp>
  28. # include <boost/type_traits/is_same.hpp>
  29. # include <boost/type_traits/remove_pointer.hpp>
  30. # include <boost/type_traits/remove_reference.hpp>
  31. # include <boost/utility/declval.hpp>
  32. # include <boost/utility/enable_if.hpp>
  33. # include <boost/utility/result_of.hpp>
  34. #endif // defined(BOOST_ASIO_HAS_TYPE_TRAITS)
  35. namespace boost {
  36. namespace asio {
  37. #if defined(BOOST_ASIO_HAS_STD_TYPE_TRAITS)
  38. using std::add_const;
  39. using std::conditional;
  40. using std::decay;
  41. using std::declval;
  42. using std::enable_if;
  43. using std::false_type;
  44. using std::integral_constant;
  45. using std::is_base_of;
  46. using std::is_class;
  47. using std::is_const;
  48. using std::is_convertible;
  49. using std::is_function;
  50. using std::is_same;
  51. using std::remove_pointer;
  52. using std::remove_reference;
  53. #if defined(BOOST_ASIO_HAS_STD_INVOKE_RESULT)
  54. template <typename> struct result_of;
  55. template <typename F, typename... Args>
  56. struct result_of<F(Args...)> : std::invoke_result<F, Args...> {};
  57. #else // defined(BOOST_ASIO_HAS_STD_INVOKE_RESULT)
  58. using std::result_of;
  59. #endif // defined(BOOST_ASIO_HAS_STD_INVOKE_RESULT)
  60. using std::true_type;
  61. #else // defined(BOOST_ASIO_HAS_STD_TYPE_TRAITS)
  62. using boost::add_const;
  63. template <bool Condition, typename Type = void>
  64. struct enable_if : boost::enable_if_c<Condition, Type> {};
  65. using boost::conditional;
  66. using boost::decay;
  67. using boost::declval;
  68. using boost::false_type;
  69. using boost::integral_constant;
  70. using boost::is_base_of;
  71. using boost::is_class;
  72. using boost::is_const;
  73. using boost::is_convertible;
  74. using boost::is_function;
  75. using boost::is_same;
  76. using boost::remove_pointer;
  77. using boost::remove_reference;
  78. using boost::result_of;
  79. using boost::true_type;
  80. #endif // defined(BOOST_ASIO_HAS_STD_TYPE_TRAITS)
  81. } // namespace asio
  82. } // namespace boost
  83. #endif // BOOST_ASIO_DETAIL_TYPE_TRAITS_HPP