...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 this object stores. |
|
The type of handler this object stores. |
Name |
Description |
---|---|
Returns a pointer to the owned object. |
|
Returns a reference to the handler. |
|
Move constructor. Copy constructor. Construct a new handler_ptr. |
|
Invoke the handler in the owned object. |
|
Returns true if *this owns an object. |
|
Return a reference to the owned object. |
|
Return a pointer to the owned object. |
|
Copy assignment (disallowed). |
|
Release ownership of the handler. |
|
Destructs the owned object if no more handler_ptr link to it. |
This is a smart pointer that retains shared ownership of an object through a pointer. Memory is managed using the allocation and deallocation functions associated with a completion handler, which is also stored in the object. The managed object is destroyed and its memory deallocated when one of the following happens:
handler_ptr::invoke
is called.
handler_ptr::release_handler
is called.
Objects of this type are used in the implementation of composed operations.
Typically the composed operation's shared state is managed by the handler_ptr
and an allocator associated
with the final handler is used to create the managed object.
The reference count is stored using a 16 bit unsigned integer. Making more than 2^16 copies of one object results in undefined behavior.
Type |
Description |
---|---|
|
The type of the owned object. |
|
The type of the completion handler. |
Convenience header <boost/beast/core.hpp>