dune-common
2.3.1
|
A reference counting smart pointer. More...
#include <dune/common/shared_ptr.hh>
Public Types | |
typedef T | element_type |
The data type we are a pointer for. More... | |
Public Member Functions | |
shared_ptr () | |
Constructs a new smart pointer and allocates the referenced Object. More... | |
shared_ptr (nullptr_t null) | |
template<class T1 > | |
shared_ptr (T1 *pointer) | |
Constructs a new smart pointer from a preallocated Object. More... | |
template<class T1 , class Deleter > | |
shared_ptr (T1 *pointer, Deleter deleter) | |
Constructs a new smart pointer from a preallocated Object. More... | |
template<class T1 > | |
shared_ptr (const shared_ptr< T1 > &pointer) | |
Copy constructor. More... | |
shared_ptr (const shared_ptr &pointer) | |
Copy constructor. More... | |
~shared_ptr () | |
Destructor. More... | |
template<class T1 > | |
shared_ptr & | operator= (const shared_ptr< T1 > &pointer) |
Assignment operator. More... | |
shared_ptr & | operator= (const shared_ptr &pointer) |
Assignment operator. More... | |
element_type & | operator* () |
Dereference as object. More... | |
element_type * | operator-> () |
Dereference as pointer. More... | |
const element_type & | operator* () const |
Dereference as const object. More... | |
const element_type * | operator-> () const |
Dereference as const pointer. More... | |
element_type * | get () const |
Access to the raw pointer, if you really want it. More... | |
operator bool () const | |
Checks if shared_ptr manages an object, i.e. whether get() != 0. More... | |
void | swap (shared_ptr &other) |
Swap content of this shared_ptr and another. More... | |
void | reset () |
Decrease the reference count by one and free the memory if the reference count has reached 0. More... | |
template<class T1 > | |
void | reset (T1 *pointer) |
Detach shared pointer and set it anew for the given pointer. More... | |
template<class T1 , class Deleter > | |
void | reset (T1 *pointer, Deleter deleter) |
int | use_count () const |
The number of shared_ptrs pointing to the object we point to. More... | |
operator __unspecified_bool_type () const | |
Implicit conversion to "bool". More... | |
template<class T1 > | |
shared_ptr< T > & | operator= (const shared_ptr< T1 > &other) |
template<class T1 > | |
shared_ptr< T > & | assign (const shared_ptr< T1 > &other) |
Friends | |
template<class T1 > | |
class | shared_ptr |
Related Functions | |
(Note that these are not member functions.) | |
template<typename T > | |
shared_ptr< T > | stackobject_to_shared_ptr (T &t) |
Convert a stack-allocated object to a shared_ptr: More... | |
template<typename T , typename T2 > | |
shared_ptr< T2 > | stackobject_to_shared_ptr (T &t) |
Convert a stack object to a shared_ptr of a base class. More... | |
A reference counting smart pointer.
It is designed such that it is usable within a std::vector. The contained object is destroyed only if there are no more references to it.
typedef T Dune::shared_ptr< T >::element_type |
The data type we are a pointer for.
This has to have a parameterless constructor.
|
inline |
Access to the raw pointer, if you really want it.
Referenced by Dune::Generic_MPI_Op< Type, BinaryFunction >::get().
|
inline |
Implicit conversion to "bool".
|
inline |
Checks if shared_ptr manages an object, i.e. whether get() != 0.
|
inline |
Assignment operator.
|
related |
Convert a stack-allocated object to a shared_ptr:
References t.
|
related |
Convert a stack object to a shared_ptr of a base class.
References t.