Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::asio::use_future_t< Allocator > Class Template Reference

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...
 

Detailed Description

template<typename Allocator = std::allocator<void>>
class boost::asio::use_future_t< Allocator >

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:

std::future<std::size_t> my_future
= my_socket.async_read_some(my_buffer, boost::asio::use_future);

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.

Member Typedef Documentation

template<typename Allocator = std::allocator<void>>
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.

Constructor & Destructor Documentation

template<typename Allocator = std::allocator<void>>
BOOST_ASIO_CONSTEXPR boost::asio::use_future_t< Allocator >::use_future_t ( )
inline

Construct using default-constructed allocator.

template<typename Allocator = std::allocator<void>>
boost::asio::use_future_t< Allocator >::use_future_t ( const Allocator &  allocator)
inlineexplicit

Construct using specified allocator.

Member Function Documentation

template<typename Allocator = std::allocator<void>>
allocator_type boost::asio::use_future_t< Allocator >::get_allocator ( ) const
inline

Obtain allocator.

template<typename Allocator = std::allocator<void>>
template<typename OtherAllocator >
use_future_t<OtherAllocator> boost::asio::use_future_t< Allocator >::operator[] ( const OtherAllocator &  allocator) const
inline

Specify an alternate allocator.


The documentation for this class was generated from the following file: