1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- #ifndef BOOST_ASIO_PACKAGED_TASK_HPP
- #define BOOST_ASIO_PACKAGED_TASK_HPP
- #if defined(_MSC_VER) && (_MSC_VER >= 1200)
- # pragma once
- #endif
- #include <boost/asio/detail/config.hpp>
- #include <boost/asio/detail/future.hpp>
- #if defined(BOOST_ASIO_HAS_STD_FUTURE_CLASS) \
- || defined(GENERATING_DOCUMENTATION)
- #include <boost/asio/async_result.hpp>
- #include <boost/asio/detail/type_traits.hpp>
- #include <boost/asio/detail/push_options.hpp>
- namespace boost {
- 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 <boost/asio/detail/pop_options.hpp>
- #endif
-
- #endif
|