123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- #ifndef ASIO_USE_FUTURE_HPP
- #define ASIO_USE_FUTURE_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 <memory>
- #include "asio/detail/type_traits.hpp"
- #include "asio/detail/push_options.hpp"
- namespace asio {
- namespace detail {
- template <typename Function, typename Allocator>
- class packaged_token;
- template <typename Function, typename Allocator, typename Result>
- class packaged_handler;
- }
- template <typename Allocator = std::allocator<void>>
- class use_future_t
- {
- public:
-
-
- typedef Allocator allocator_type;
-
- constexpr use_future_t()
- {
- }
-
- explicit use_future_t(const Allocator& allocator)
- : allocator_(allocator)
- {
- }
- #if !defined(ASIO_NO_DEPRECATED)
-
- template <typename OtherAllocator>
- use_future_t<OtherAllocator> operator[](const OtherAllocator& allocator) const
- {
- return use_future_t<OtherAllocator>(allocator);
- }
- #endif
-
- template <typename OtherAllocator>
- use_future_t<OtherAllocator> rebind(const OtherAllocator& allocator) const
- {
- return use_future_t<OtherAllocator>(allocator);
- }
-
- allocator_type get_allocator() const
- {
- return allocator_;
- }
-
-
- template <typename Function>
- #if defined(GENERATING_DOCUMENTATION)
- unspecified
- #else
- detail::packaged_token<decay_t<Function>, Allocator>
- #endif
- operator()(Function&& f) const;
- private:
-
-
- struct std_allocator_void
- {
- constexpr std_allocator_void()
- {
- }
- operator std::allocator<void>() const
- {
- return std::allocator<void>();
- }
- };
- conditional_t<
- is_same<std::allocator<void>, Allocator>::value,
- std_allocator_void, Allocator> allocator_;
- };
- constexpr use_future_t<> use_future;
- }
- #include "asio/detail/pop_options.hpp"
- #include "asio/impl/use_future.hpp"
- #endif
-
- #endif
|