123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- #ifndef ASIO_PACKAGED_TASK_HPP
- #define ASIO_PACKAGED_TASK_HPP
- #if defined(_MSC_VER) && (_MSC_VER >= 1200)
- # pragma once
- #endif
- #include "asio/detail/config.hpp"
- #include "asio/detail/future.hpp"
- #if defined(ASIO_HAS_STD_FUTURE_CLASS) \
- || defined(GENERATING_DOCUMENTATION)
- #include "asio/async_result.hpp"
- #include "asio/detail/type_traits.hpp"
- #include "asio/detail/push_options.hpp"
- namespace asio {
- template <typename Result, typename... Args, typename Signature>
- class async_result<std::packaged_task<Result(Args...)>, Signature>
- {
- public:
-
- typedef std::packaged_task<Result(Args...)> completion_handler_type;
-
-
- typedef std::future<Result> return_type;
-
- explicit async_result(completion_handler_type& h)
- : future_(h.get_future())
- {
- }
-
- return_type get()
- {
- return std::move(future_);
- }
- private:
- return_type future_;
- };
- }
- #include "asio/detail/pop_options.hpp"
- #endif
-
- #endif
|