File indexing completed on 2025-01-18 09:29:10
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_ASIO_PACKAGED_TASK_HPP
0012 #define BOOST_ASIO_PACKAGED_TASK_HPP
0013
0014 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0015 # pragma once
0016 #endif
0017
0018 #include <boost/asio/detail/config.hpp>
0019 #include <boost/asio/detail/future.hpp>
0020
0021 #if defined(BOOST_ASIO_HAS_STD_FUTURE_CLASS) \
0022 || defined(GENERATING_DOCUMENTATION)
0023
0024 #include <boost/asio/async_result.hpp>
0025 #include <boost/asio/detail/type_traits.hpp>
0026
0027 #include <boost/asio/detail/push_options.hpp>
0028
0029 namespace boost {
0030 namespace asio {
0031
0032
0033 template <typename Result, typename... Args, typename Signature>
0034 class async_result<std::packaged_task<Result(Args...)>, Signature>
0035 {
0036 public:
0037
0038 typedef std::packaged_task<Result(Args...)> completion_handler_type;
0039
0040
0041
0042 typedef std::future<Result> return_type;
0043
0044
0045 explicit async_result(completion_handler_type& h)
0046 : future_(h.get_future())
0047 {
0048 }
0049
0050
0051 return_type get()
0052 {
0053 return std::move(future_);
0054 }
0055
0056 private:
0057 return_type future_;
0058 };
0059
0060 }
0061 }
0062
0063 #include <boost/asio/detail/pop_options.hpp>
0064
0065 #endif
0066
0067
0068 #endif