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

This is the documentation for an old version of boost. Click here for the latest Boost documentation.
PrevUpHomeNext

handler_ptr

A smart pointer container with associated completion handler.

Synopsis

Defined in header <boost/beast/core/handler_ptr.hpp>

template<
    class T,
    class Handler>
class handler_ptr
Types

Name

Description

element_type

The type of element stored.

handler_type

The type of handler stored.

Member Functions

Name

Description

get

Return a pointer to the owned object.

handler

Return a reference to the handler.

handler_ptr

Default constructor (deleted).

Move constructor.

Copy constructor (deleted).

Constructor.

has_value

Return true if *this owns an object.

invoke

Invoke the handler in the owned object.

operator*

Return a reference to the owned object.

operator->

Return a pointer to the owned object.

operator=

Copy assignment (deleted).

Move assignment (deleted).

release_handler

Return ownership of the handler.

~handler_ptr

Destructor.

Description

This is a smart pointer that retains unique ownership of an object through a pointer. Memory is managed using the allocator associated with a completion handler stored in the object. The managed object is destroyed and its memory deallocated when one of the following occurs:

Objects of this type are used in the implementation of composed operations with states that are expensive or impossible to move. This container manages that non-trivial state on behalf of the composed operation.

Thread Safety

Distinct objects: Safe.

Shared objects: Unsafe.

Template Parameters

Type

Description

T

The type of the owned object. Must be noexcept destructible.

Handler

The type of the completion handler.

Convenience header <boost/beast/core.hpp>


PrevUpHomeNext