Enhancement of std::enable_shared_from_this. More...
#include <enable_shared_from_this.h>

Public Member Functions | |
| std::shared_ptr< T > | shared_from_this () |
| std::shared_ptr< const T > | shared_from_this () const |
| virtual | ~enable_shared_from_this ()=default |
Protected Attributes | |
| std::weak_ptr< T > | weak_ptr_ |
Enhancement of std::enable_shared_from_this.
This class enhances/replaces std::enable_shared_from_this. AMP has use cases that are not properly handled by enable_shared_from_this. Specifically some of the vectors in AMP are managed by external packages that do not use shared_ptr. AMP then requires a shared_ptr for some of its interfaces. This causes a problem because if we try to use shared_from_this() on a pointer that is not managed by the smart pointer, then the function crashes. An example of this occurs in PetscManagedVector where PETSc manages the vectors, but we want to enable the underlying data to be an AMP vector. This class provides the additional functionallity
Definition at line 25 of file enable_shared_from_this.h.
|
virtualdefault |
|
inline |
Definition at line 28 of file enable_shared_from_this.h.
References AMP_ASSERT, and AMP::enable_shared_from_this< T >::weak_ptr_.
|
inline |
Definition at line 46 of file enable_shared_from_this.h.
References AMP_ASSERT, and AMP::enable_shared_from_this< T >::weak_ptr_.
|
mutableprotected |
Definition at line 69 of file enable_shared_from_this.h.
Referenced by AMP::enable_shared_from_this< T >::shared_from_this(), and AMP::enable_shared_from_this< T >::shared_from_this().
|
Advanced Multi-Physics (AMP) Oak Ridge National Laboratory Idaho National Laboratory Los Alamos National Laboratory |
This page automatically produced from the source code by Last updated: Tue Mar 10 2026 13:06:42. Comments on this page |