deprecated_async_result.hpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. //
  2. // async_result.hpp
  3. // ~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2019 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 ARCHETYPES_DEPRECATED_ASYNC_RESULT_HPP
  11. #define ARCHETYPES_DEPRECATED_ASYNC_RESULT_HPP
  12. #include <boost/asio/async_result.hpp>
  13. #if !defined(BOOST_ASIO_NO_DEPRECATED)
  14. #include <boost/asio/handler_type.hpp>
  15. namespace archetypes {
  16. struct deprecated_lazy_handler
  17. {
  18. };
  19. struct deprecated_concrete_handler
  20. {
  21. deprecated_concrete_handler(deprecated_lazy_handler)
  22. {
  23. }
  24. template <typename Arg1>
  25. void operator()(Arg1)
  26. {
  27. }
  28. template <typename Arg1, typename Arg2>
  29. void operator()(Arg1, Arg2)
  30. {
  31. }
  32. #if defined(BOOST_ASIO_HAS_MOVE)
  33. deprecated_concrete_handler(deprecated_concrete_handler&&) {}
  34. private:
  35. deprecated_concrete_handler(const deprecated_concrete_handler&);
  36. #endif // defined(BOOST_ASIO_HAS_MOVE)
  37. };
  38. } // namespace archetypes
  39. namespace boost {
  40. namespace asio {
  41. template <typename Signature>
  42. struct handler_type<archetypes::deprecated_lazy_handler, Signature>
  43. {
  44. typedef archetypes::deprecated_concrete_handler type;
  45. };
  46. template <>
  47. class async_result<archetypes::deprecated_concrete_handler>
  48. {
  49. public:
  50. // The return type of the initiating function.
  51. typedef double type;
  52. // Construct an async_result from a given handler.
  53. explicit async_result(archetypes::deprecated_concrete_handler&)
  54. {
  55. }
  56. // Obtain the value to be returned from the initiating function.
  57. type get()
  58. {
  59. return 42;
  60. }
  61. };
  62. } // namespace asio
  63. } // namespace boost
  64. #endif // !defined(BOOST_ASIO_NO_DEPRECATED)
  65. #endif // ARCHETYPES_DEPRECATED_ASYNC_RESULT_HPP