void_receiver.hpp 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. //
  2. // execution/detail/void_receiver.hpp
  3. // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2022 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_EXECUTION_DETAIL_VOID_RECEIVER_HPP
  11. #define ASIO_EXECUTION_DETAIL_VOID_RECEIVER_HPP
  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. #include "asio/traits/set_done_member.hpp"
  17. #include "asio/traits/set_error_member.hpp"
  18. #include "asio/traits/set_value_member.hpp"
  19. #include "asio/detail/push_options.hpp"
  20. namespace asio {
  21. namespace execution {
  22. namespace detail {
  23. struct void_receiver
  24. {
  25. void set_value() ASIO_NOEXCEPT
  26. {
  27. }
  28. template <typename E>
  29. void set_error(ASIO_MOVE_ARG(E)) ASIO_NOEXCEPT
  30. {
  31. }
  32. void set_done() ASIO_NOEXCEPT
  33. {
  34. }
  35. };
  36. } // namespace detail
  37. } // namespace execution
  38. namespace traits {
  39. #if !defined(ASIO_HAS_DEDUCED_SET_VALUE_MEMBER_TRAIT)
  40. template <>
  41. struct set_value_member<asio::execution::detail::void_receiver, void()>
  42. {
  43. ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
  44. ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
  45. typedef void result_type;
  46. };
  47. #endif // !defined(ASIO_HAS_DEDUCED_SET_VALUE_MEMBER_TRAIT)
  48. #if !defined(ASIO_HAS_DEDUCED_SET_ERROR_MEMBER_TRAIT)
  49. template <typename E>
  50. struct set_error_member<asio::execution::detail::void_receiver, E>
  51. {
  52. ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
  53. ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
  54. typedef void result_type;
  55. };
  56. #endif // !defined(ASIO_HAS_DEDUCED_SET_ERROR_MEMBER_TRAIT)
  57. #if !defined(ASIO_HAS_DEDUCED_SET_DONE_MEMBER_TRAIT)
  58. template <>
  59. struct set_done_member<asio::execution::detail::void_receiver>
  60. {
  61. ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
  62. ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
  63. typedef void result_type;
  64. };
  65. #endif // !defined(ASIO_HAS_DEDUCED_SET_DONE_MEMBER_TRAIT)
  66. } // namespace traits
  67. } // namespace asio
  68. #include "asio/detail/pop_options.hpp"
  69. #endif // ASIO_EXECUTION_DETAIL_VOID_RECEIVER_HPP