Advanced Multi-Physics (AMP)
On-Line Documentation
Public Member Functions | Protected Attributes | List of all members
AMP::enable_shared_from_this< T > Class Template Reference

Enhancement of std::enable_shared_from_this. More...

#include <enable_shared_from_this.h>

Inheritance diagram for AMP::enable_shared_from_this< T >:
Inheritance graph
[legend]

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_
 

Detailed Description

template<class T>
class AMP::enable_shared_from_this< T >

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.

Constructor & Destructor Documentation

◆ ~enable_shared_from_this()

template<class T >
virtual AMP::enable_shared_from_this< T >::~enable_shared_from_this ( )
virtualdefault

Member Function Documentation

◆ shared_from_this() [1/2]

template<class T >
std::shared_ptr< T > AMP::enable_shared_from_this< T >::shared_from_this ( )
inline

◆ shared_from_this() [2/2]

template<class T >
std::shared_ptr< const T > AMP::enable_shared_from_this< T >::shared_from_this ( ) const
inline

Member Data Documentation

◆ weak_ptr_

template<class T >
std::weak_ptr<T> AMP::enable_shared_from_this< T >::weak_ptr_
mutableprotected

The documentation for this class was generated from the following file:



Advanced Multi-Physics (AMP)
Oak Ridge National Laboratory
Idaho National Laboratory
Los Alamos National Laboratory
This page automatically produced from the
source code by doxygen
Last updated: Tue Mar 10 2026 13:06:42.
Comments on this page