Class used to specify that an asynchronous operation should return a future. More...
#include <use_future.hpp>
Public Types | |
typedef Allocator | allocator_type |
The allocator type. More... | |
Public Member Functions | |
BOOST_ASIO_CONSTEXPR | use_future_t () |
Construct using default-constructed allocator. More... | |
use_future_t (const Allocator &allocator) | |
Construct using specified allocator. More... | |
template<typename OtherAllocator > | |
use_future_t< OtherAllocator > | operator[] (const OtherAllocator &allocator) const |
Specify an alternate allocator. More... | |
allocator_type | get_allocator () const |
Obtain allocator. More... | |
Class used to specify that an asynchronous operation should return a future.
The use_future_t class is used to indicate that an asynchronous operation should return a std::future object. A use_future_t object may be passed as a handler to an asynchronous operation, typically using the special value boost::asio::use_future
. For example:
The initiating function (async_read_some in the above example) returns a future that will receive the result of the operation. If the operation completes with an error_code indicating failure, it is converted into a system_error and passed back to the caller via the future.
typedef Allocator boost::asio::use_future_t< Allocator >::allocator_type |
The allocator type.
The allocator is used when constructing the std::promise
object for a given asynchronous operation.
|
inline |
Construct using default-constructed allocator.
|
inlineexplicit |
Construct using specified allocator.
|
inline |
Obtain allocator.
|
inline |
Specify an alternate allocator.