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 11 #ifndef ARCHETYPES_DEPRECATED_ASYNC_RESULT_HPP 12 #define ARCHETYPES_DEPRECATED_ASYNC_RESULT_HPP 13 14 #include <boost/asio/async_result.hpp> 15 16 #if !defined(BOOST_ASIO_NO_DEPRECATED) 17 18 #include <boost/asio/handler_type.hpp> 19 20 namespace archetypes { 21 22 struct deprecated_lazy_handler 23 { 24 }; 25 26 struct deprecated_concrete_handler 27 { deprecated_concrete_handlerarchetypes::deprecated_concrete_handler28 deprecated_concrete_handler(deprecated_lazy_handler) 29 { 30 } 31 32 template <typename Arg1> operator ()archetypes::deprecated_concrete_handler33 void operator()(Arg1) 34 { 35 } 36 37 template <typename Arg1, typename Arg2> operator ()archetypes::deprecated_concrete_handler38 void operator()(Arg1, Arg2) 39 { 40 } 41 42 #if defined(BOOST_ASIO_HAS_MOVE) deprecated_concrete_handlerarchetypes::deprecated_concrete_handler43 deprecated_concrete_handler(deprecated_concrete_handler&&) {} 44 private: 45 deprecated_concrete_handler(const deprecated_concrete_handler&); 46 #endif // defined(BOOST_ASIO_HAS_MOVE) 47 }; 48 49 } // namespace archetypes 50 51 namespace boost { 52 namespace asio { 53 54 template <typename Signature> 55 struct handler_type<archetypes::deprecated_lazy_handler, Signature> 56 { 57 typedef archetypes::deprecated_concrete_handler type; 58 }; 59 60 template <> 61 class async_result<archetypes::deprecated_concrete_handler> 62 { 63 public: 64 // The return type of the initiating function. 65 typedef double type; 66 67 // Construct an async_result from a given handler. async_result(archetypes::deprecated_concrete_handler &)68 explicit async_result(archetypes::deprecated_concrete_handler&) 69 { 70 } 71 72 // Obtain the value to be returned from the initiating function. get()73 type get() 74 { 75 return 42; 76 } 77 }; 78 79 } // namespace asio 80 } // namespace boost 81 82 #endif // !defined(BOOST_ASIO_NO_DEPRECATED) 83 84 #endif // ARCHETYPES_DEPRECATED_ASYNC_RESULT_HPP 85