any_completion_executor.ipp 3.2 KB

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