Base Framework
Public Member Functions | List of all members
Lifetime< TYPE > Class Template Reference

Lifetime automation pointer. More...

#include <base/mem/Lifetime.h>

Inherits NotCopyable.

Public Member Functions

 Lifetime (TYPE *_object)
 
TYPE & operator* ()
 
const TYPE & operator* () const noexcept
 
TYPE * operator-> ()
 
const TYPE * operator-> () const
 
 ~Lifetime ()
 

Detailed Description

template<class TYPE>
class Lifetime< TYPE >

Lifetime automation pointer.

Automation pointer which guarantees a valid pointer (not 0). The object is destroyed when the automation pointer falls out of scope.

Version
1.0

Constructor & Destructor Documentation

◆ Lifetime()

template<class TYPE >
Lifetime< TYPE >::Lifetime ( TYPE *  _object)
inline

Initializes the automation pointer.

Parameters
objectThe object pointer to be automated.

◆ ~Lifetime()

template<class TYPE >
Lifetime< TYPE >::~Lifetime ( )
inline

Destroys the automation pointer (and the object).

Member Function Documentation

◆ operator*() [1/2]

template<class TYPE >
TYPE& Lifetime< TYPE >::operator* ( )
inline

Returns mutable object.

◆ operator*() [2/2]

template<class TYPE >
const TYPE& Lifetime< TYPE >::operator* ( ) const
inlinenoexcept

Returns constant object.

◆ operator->() [1/2]

template<class TYPE >
TYPE* Lifetime< TYPE >::operator-> ( )
inline

Returns object for modifying access.

◆ operator->() [2/2]

template<class TYPE >
const TYPE* Lifetime< TYPE >::operator-> ( ) const
inline

Returns object for non-modifying access.