void_receiver.hpp 2.3 KB

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