any_io_executor.ipp 3.1 KB

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