Dune Core Modules (2.3.1)

Dune::null_deleter< T > Struct Template Reference

implements the Deleter concept of shared_ptr without deleting anything More...

#include <dune/common/shared_ptr.hh>

Detailed Description

template<class T>
struct Dune::null_deleter< T >

implements the Deleter concept of shared_ptr without deleting anything

If you allocate an object on the stack, but want to pass it to a class or function as a shared_ptr, you can use this deleter to avoid accidental deletion of the stack-allocated object.

For convenience we provide two free functions to create a shared_ptr from a stack-allocated object (

See also
stackobject_to_shared_ptr):

1) Convert a stack-allocated object to a shared_ptr:

int i = 10;
shared_ptr<int> pi = stackobject_to_shared_ptr(i);

2) Convert a stack-allocated object to a shared_ptr of a base class

class A {};
class B : public A {};
...
B b;
shared_ptr<A> pa = stackobject_to_shared_ptr<A>(b);
Template Parameters
Ttype of the stack-allocated object

The documentation for this struct was generated from the following file:
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.80.0 (May 14, 22:30, 2024)