This class allows an object that is currently managed by a shared_ptr to safely generate a copy of the managing shared_ptr object. Inheriting from enable_shared_from_this<ELEMENT_TYPE> provides the (template parameter) ELEMENT_TYPE type with a member function shared_from_this. If an object of type ELEMENT_TYPE is managed by a shared_ptr then calling shared_from_this will return a shared_ptr<ELEMENT_TYPE> that shares ownership of that object. It is undefined behavior to call shared_from_this on an object unless that object is managed by a shared_ptr.
Synopsis
Declared in <bslstl_sharedptr.h>
template<class ELEMENT_TYPE>
class enable_shared_from_this;
Description
The intended use of enable_shared_from_this is that the (template parameter) type ELEMENT_TYPE inherits directly from the enable_shared_from_this class template. In the case of multiple inheritance, only one of the base classes should inherit from the enable_shared_from_this class template. If multiple base classes inherit from enable_shared_from_this, then there will be ambiguous calls to the shared_from_this function.
Member Functions
Name |
Description |
|
|
|
Protected Member Functions
Name |
Description |
|
Constructors |
|
Destroy this |
Return |
Derived Classes
Name |
Description |
Provides the implementation of a signaler. This object has a 1‐1 relationship with the |
Created with MrDocs