any_completion_executor.ipp 3.1 KB

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