Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
Arcane::ScopedPtrT< T > Class Template Reference

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.

Detailed Description

template<class T>
class Arcane::ScopedPtrT< T >

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.

Since
0.4.40
Author
Gilles Grospellier
Date
16/07/2001

Definition at line 42 of file ScopedPtr.h.

Member Typedef Documentation

◆ BaseClass

template<class T>
typedef PtrT<T> Arcane::ScopedPtrT< T >::BaseClass

Base class type.

Definition at line 48 of file ScopedPtr.h.

Constructor & Destructor Documentation

◆ ScopedPtrT() [1/2]

template<class T>
Arcane::ScopedPtrT< T >::ScopedPtrT ( )
inline

Constructs an instance without a reference.

Definition at line 53 of file ScopedPtr.h.

Referenced by operator=(), and operator=().

◆ ScopedPtrT() [2/2]

template<class T>
Arcane::ScopedPtrT< T >::ScopedPtrT ( T * t)
inlineexplicit

Constructs an instance referencing t.

Definition at line 58 of file ScopedPtr.h.

◆ ~ScopedPtrT()

template<class T>
Arcane::ScopedPtrT< T >::~ScopedPtrT ( )
inline

Destroys the referenced object.

Definition at line 63 of file ScopedPtr.h.

References Arcane::PtrT< T >::m_value.

Member Function Documentation

◆ operator=() [1/2]

template<class T>
const ScopedPtrT< T > & Arcane::ScopedPtrT< T >::operator= ( const ScopedPtrT< T > & from)
inline

Copy operator.

Definition at line 68 of file ScopedPtr.h.

References Arcane::PtrT< T >::m_value, Arcane::PtrT< T >::operator=(), and ScopedPtrT().

◆ operator=() [2/2]

template<class T>
const ScopedPtrT< T > & Arcane::ScopedPtrT< T >::operator= ( T * new_value)
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().


The documentation for this class was generated from the following file: