DUNE PDELab (git)

Common Utilities

Functions

template<typename T >
std::shared_ptr< T > Dune::PDELab::ensure_shared_ptr (T &t)
 Ensures that t is wrapped in a shared_ptr<T> More...
 

Detailed Description

Function Documentation

◆ ensure_shared_ptr()

template<typename T >
std::shared_ptr< T > Dune::PDELab::ensure_shared_ptr ( T &  t)

Ensures that t is wrapped in a shared_ptr<T>

You have to consider three situations:

a) t is of type T& t is a stack object and must not be deleted. You create a shared_ptr<T>(&t) with a null_deleter. b) t is of type T* t is a raw pointer and the user os assumed to own this pointer. You create a shared_ptr<T>(t) with a null_deleter. c) t is of type shared_ptr<T> t is already a shared_ptr<T>. You don't have to do anything.

Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 23, 23:29, 2024)