...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
A smart pointer container with associated completion handler.
Defined in header <boost/beast/core/handler_ptr.hpp>
template< class T, class Handler> class handler_ptr
Name |
Description |
---|---|
The type of element stored. |
|
The type of handler stored. |
Name |
Description |
---|---|
Return a pointer to the owned object. |
|
Return a reference to the handler. |
|
Default constructor (deleted). Move constructor. Copy constructor (deleted). Constructor. |
|
Return true if *this owns an object. |
|
Invoke the handler in the owned object. |
|
Return a reference to the owned object. |
|
Return a pointer to the owned object. |
|
Copy assignment (deleted). Move assignment (deleted). |
|
Return ownership of the handler. |
|
Destructor. |
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:
handler_ptr::invoke
is called.
handler_ptr::release_handler
is called.
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.
Distinct objects: Safe.
Shared objects: Unsafe.
Type |
Description |
---|---|
|
The type of the owned object. Must be noexcept destructible. |
|
The type of the completion handler. |
Convenience header <boost/beast/core.hpp>