Encapsulation of an automatically destructing pointer. More...
#include <arcane/utils/ScopedPtr.h>
Public Types | |
| typedef PtrT< T > | BaseClass |
| Base class type. | |
Public Member Functions | |
| ScopedPtrT () | |
| Constructs an instance without a reference. | |
| ScopedPtrT (T *t) | |
| Constructs an instance referencing t. | |
| ~ScopedPtrT () | |
| Destroys the referenced object. | |
| const ScopedPtrT< T > & | operator= (const ScopedPtrT< T > &from) |
| Copy operator. | |
| const ScopedPtrT< T > & | operator= (T *new_value) |
| Assigns the value new_value to the instance. | |
| Public Member Functions inherited from Arcane::PtrT< T > | |
| PtrT ()=default | |
| Constructs an instance without a reference. | |
| PtrT (T *t) | |
| Constructs an instance referring to t. | |
| T * | operator-> () const |
| Returns the object referenced by the instance. | |
| T & | operator* () const |
| Returns the object referenced by the instance. | |
| T * | get () const |
| Returns the object referenced by the instance. | |
| bool | isNull () const |
Additional Inherited Members | |
| Protected Member Functions inherited from Arcane::PtrT< T > | |
| PtrT< T > & | operator= (const PtrT< T > &from) |
| Copy operator. | |
| template<typename T2> | |
| PtrT< T > & | operator= (const PtrT< T2 > &from) |
| PtrT< T > & | operator= (T *new_value) |
| Assigns the value new_value to the instance. | |
| PtrT (const PtrT< T > &from) | |
| Constructs a reference referring to from. | |
| template<typename T2> | |
| PtrT (const PtrT< T2 > &from) | |
| Constructs a reference referring to from. | |
| Protected Attributes inherited from Arcane::PtrT< T > | |
| T * | m_value = nullptr |
| Pointer to the referenced object. | |
Encapsulation of an automatically destructing pointer.
This class encapsulates a pointer to an object that will be destroyed (via the delete operator) when the instance of this class goes out of scope.
This class is useful to ensure that an object is deallocated even if an exception occurs.
Definition at line 42 of file ScopedPtr.h.
| typedef PtrT<T> Arcane::ScopedPtrT< T >::BaseClass |
Base class type.
Definition at line 48 of file ScopedPtr.h.
|
inline |
Constructs an instance without a reference.
Definition at line 53 of file ScopedPtr.h.
Referenced by operator=(), and operator=().
|
inlineexplicit |
Constructs an instance referencing t.
Definition at line 58 of file ScopedPtr.h.
|
inline |
Destroys the referenced object.
Definition at line 63 of file ScopedPtr.h.
References Arcane::PtrT< T >::m_value.
|
inline |
Copy operator.
Definition at line 68 of file ScopedPtr.h.
References Arcane::PtrT< T >::m_value, Arcane::PtrT< T >::operator=(), and ScopedPtrT().
|
inline |
Assigns the value new_value to the instance.
Definition at line 78 of file ScopedPtr.h.
References Arcane::PtrT< T >::m_value, and ScopedPtrT().