any_io_executor.ipp 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. //
  2. // impl/any_io_executor.ipp
  3. // ~~~~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2024 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_IMPL_ANY_IO_EXECUTOR_IPP
  11. #define BOOST_ASIO_IMPL_ANY_IO_EXECUTOR_IPP
  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_USE_TS_EXECUTOR_AS_DEFAULT)
  17. #include <boost/asio/any_io_executor.hpp>
  18. #include <boost/asio/detail/push_options.hpp>
  19. namespace boost {
  20. namespace asio {
  21. any_io_executor::any_io_executor() noexcept
  22. : base_type()
  23. {
  24. }
  25. any_io_executor::any_io_executor(nullptr_t) noexcept
  26. : base_type(nullptr_t())
  27. {
  28. }
  29. any_io_executor::any_io_executor(const any_io_executor& e) noexcept
  30. : base_type(static_cast<const base_type&>(e))
  31. {
  32. }
  33. any_io_executor::any_io_executor(std::nothrow_t,
  34. const any_io_executor& e) noexcept
  35. : base_type(static_cast<const base_type&>(e))
  36. {
  37. }
  38. any_io_executor::any_io_executor(any_io_executor&& e) noexcept
  39. : base_type(static_cast<base_type&&>(e))
  40. {
  41. }
  42. any_io_executor::any_io_executor(std::nothrow_t, any_io_executor&& e) noexcept
  43. : base_type(static_cast<base_type&&>(e))
  44. {
  45. }
  46. any_io_executor& any_io_executor::operator=(const any_io_executor& e) noexcept
  47. {
  48. base_type::operator=(static_cast<const base_type&>(e));
  49. return *this;
  50. }
  51. any_io_executor& any_io_executor::operator=(any_io_executor&& e) noexcept
  52. {
  53. base_type::operator=(static_cast<base_type&&>(e));
  54. return *this;
  55. }
  56. any_io_executor& any_io_executor::operator=(nullptr_t)
  57. {
  58. base_type::operator=(nullptr_t());
  59. return *this;
  60. }
  61. any_io_executor::~any_io_executor()
  62. {
  63. }
  64. void any_io_executor::swap(any_io_executor& other) noexcept
  65. {
  66. static_cast<base_type&>(*this).swap(static_cast<base_type&>(other));
  67. }
  68. template <>
  69. any_io_executor any_io_executor::require(
  70. const execution::blocking_t::never_t& p, int) const
  71. {
  72. return static_cast<const base_type&>(*this).require(p);
  73. }
  74. template <>
  75. any_io_executor any_io_executor::prefer(
  76. const execution::blocking_t::possibly_t& p, int) const
  77. {
  78. return static_cast<const base_type&>(*this).prefer(p);
  79. }
  80. template <>
  81. any_io_executor any_io_executor::prefer(
  82. const execution::outstanding_work_t::tracked_t& p, int) const
  83. {
  84. return static_cast<const base_type&>(*this).prefer(p);
  85. }
  86. template <>
  87. any_io_executor any_io_executor::prefer(
  88. const execution::outstanding_work_t::untracked_t& p, int) const
  89. {
  90. return static_cast<const base_type&>(*this).prefer(p);
  91. }
  92. template <>
  93. any_io_executor any_io_executor::prefer(
  94. const execution::relationship_t::fork_t& p, int) const
  95. {
  96. return static_cast<const base_type&>(*this).prefer(p);
  97. }
  98. template <>
  99. any_io_executor any_io_executor::prefer(
  100. const execution::relationship_t::continuation_t& p, int) const
  101. {
  102. return static_cast<const base_type&>(*this).prefer(p);
  103. }
  104. } // namespace asio
  105. } // namespace boost
  106. #include <boost/asio/detail/pop_options.hpp>
  107. #endif // !defined(BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT)
  108. #endif // BOOST_ASIO_IMPL_ANY_IO_EXECUTOR_IPP