type_traits.hpp 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. //
  2. // detail/type_traits.hpp
  3. // ~~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2018 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/enable_if.hpp>
  32. # include <boost/utility/result_of.hpp>
  33. #endif // defined(BOOST_ASIO_HAS_TYPE_TRAITS)
  34. namespace boost {
  35. namespace asio {
  36. #if defined(BOOST_ASIO_HAS_STD_TYPE_TRAITS)
  37. using std::add_const;
  38. using std::conditional;
  39. using std::decay;
  40. using std::enable_if;
  41. using std::false_type;
  42. using std::integral_constant;
  43. using std::is_base_of;
  44. using std::is_class;
  45. using std::is_const;
  46. using std::is_convertible;
  47. using std::is_function;
  48. using std::is_same;
  49. using std::remove_pointer;
  50. using std::remove_reference;
  51. #if defined(BOOST_ASIO_HAS_STD_INVOKE_RESULT)
  52. template <typename> struct result_of;
  53. template <typename F, typename... Args>
  54. struct result_of<F(Args...)> : std::invoke_result<F, Args...> {};
  55. #else // defined(BOOST_ASIO_HAS_STD_INVOKE_RESULT)
  56. using std::result_of;
  57. #endif // defined(BOOST_ASIO_HAS_STD_INVOKE_RESULT)
  58. using std::true_type;
  59. #else // defined(BOOST_ASIO_HAS_STD_TYPE_TRAITS)
  60. using boost::add_const;
  61. template <bool Condition, typename Type = void>
  62. struct enable_if : boost::enable_if_c<Condition, Type> {};
  63. using boost::conditional;
  64. using boost::decay;
  65. using boost::false_type;
  66. using boost::integral_constant;
  67. using boost::is_base_of;
  68. using boost::is_class;
  69. using boost::is_const;
  70. using boost::is_convertible;
  71. using boost::is_function;
  72. using boost::is_same;
  73. using boost::remove_pointer;
  74. using boost::remove_reference;
  75. using boost::result_of;
  76. using boost::true_type;
  77. #endif // defined(BOOST_ASIO_HAS_STD_TYPE_TRAITS)
  78. } // namespace asio
  79. } // namespace boost
  80. #endif // BOOST_ASIO_DETAIL_TYPE_TRAITS_HPP