Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

async_result
PrevUpHomeNext

An interface for customising the behaviour of an initiating function.

template<
    typename CompletionToken,
    typename... Signatures>
class async_result
Types

Name

Description

completion_handler_type

(Legacy.) The concrete completion handler type for the specific signature.

return_type

(Legacy.) The return type of the initiating function.

Member Functions

Name

Description

async_result [constructor]

(Legacy.) Construct an async result from a given handler.

get

(Legacy.) Obtain the value to be returned from the initiating function.

initiate [static]

Initiate the asynchronous operation that will produce the result, and obtain the value to be returned from the initiating function.

The async_result trait is a customisation point that is used within the initiating function for an asynchronous operation. The trait combines:

  • the completion signature (or signatures) that describe the arguments that an asynchronous operation will pass to a completion handler;
  • the completion token type supplied by the caller; and
  • the operation's internal implementation.

Specialisations of the trait must satisfy the async_result_requirements, and are reponsible for determining:

  • the concrete completion handler type to be called at the end of the asynchronous operation;
  • the initiating function return type;
  • how the return value of the initiating function is obtained; and
  • how and when to launch the operation by invoking the supplied initiation function object.

This template may be specialised for user-defined completion token types. The primary template assumes that the CompletionToken is the already a concrete completion handler.

Remarks

For backwards compatibility, the primary template implements member types and functions that are associated with legacy forms of the async_result trait. These are annotated as "Legacy" in the documentation below. User specialisations of this trait do not need to implement these in order to satisfy the async_result_requirements.

In general, implementers of asynchronous operations should use the async_initiate function rather than using the async_result trait directly.

Requirements

Header: boost/asio/async_result.hpp

Convenience header: boost/asio.hpp


PrevUpHomeNext