|
dune-common 2.8.0
|
implements the Deleter concept of shared_ptr without deleting anything More...
#include <dune/common/shared_ptr.hh>
Public Member Functions | |
| void | operator() (T *) const |
Related Symbols | |
(Note that these are not member symbols.) | |
| template<typename T > | |
| std::shared_ptr< T > | stackobject_to_shared_ptr (T &t) |
| Create a shared_ptr for a stack-allocated object. | |
Detailed Description
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:
2) Convert a stack-allocated object to a std::shared_ptr of a base class
- Template Parameters
-
T type of the stack-allocated object
Member Function Documentation
◆ operator()()
|
inline |
Friends And Related Symbol Documentation
◆ stackobject_to_shared_ptr()
|
related |
Create a shared_ptr for a stack-allocated object.
Usage:
The std::shared_ptr points to the object on the stack, but its deleter is set to an instance of null_deleter so that nothing happens when the shared_ptr is destroyed.
- See also
- null_deleter
The documentation for this struct was generated from the following file:
Legal Statements / Impressum | Hosted by TU Dresden & Uni Heidelberg | Generated by
1.9.8