ScummVM API documentation
Common::ScopedPtr< T, DL > Class Template Reference
Inheritance diagram for Common::ScopedPtr< T, DL >:
Common::NonCopyable Common::SafeBool< ScopedPtr< T, DL > > Common::impl::no_base< ScopedPtr< T, DL > >

Public Types

typedef T ValueType
 
typedef T * PointerType
 
typedef T & ReferenceType
 

Public Member Functions

 ScopedPtr (PointerType o=nullptr)
 
 ScopedPtr (std::nullptr_t)
 
template<class T2 >
 ScopedPtr (ScopedPtr< T2 > &&o)
 
ReferenceType operator* () const
 
PointerType operator-> () const
 
bool operator_bool () const
 
void reset (PointerType o=nullptr)
 
ScopedPtroperator= (std::nullptr_t)
 
template<class T2 >
ScopedPtroperator= (ScopedPtr< T2 > &&other)
 
PointerType get () const
 
PointerType release ()
 
- Public Member Functions inherited from Common::SafeBool< ScopedPtr< T, DL > >
 operator bool_type () const
 
 operator bool_type ()
 

Constructor & Destructor Documentation

◆ ScopedPtr()

template<typename T, class DL = DefaultDeleter<T>>
template<class T2 >
Common::ScopedPtr< T, DL >::ScopedPtr ( ScopedPtr< T2 > &&  o)
inline

Move constructor

Member Function Documentation

◆ operator_bool()

template<typename T, class DL = DefaultDeleter<T>>
bool Common::ScopedPtr< T, DL >::operator_bool ( ) const
inline

Implicit conversion operator to bool for convenience, to make checks like "if (scopedPtr) ..." possible.

◆ reset()

template<typename T, class DL = DefaultDeleter<T>>
void Common::ScopedPtr< T, DL >::reset ( PointerType  o = nullptr)
inline

Resets the pointer with the new value. Old object will be destroyed

◆ operator=() [1/2]

template<typename T, class DL = DefaultDeleter<T>>
ScopedPtr& Common::ScopedPtr< T, DL >::operator= ( std::nullptr_t  )
inline

Affectation with nullptr

◆ operator=() [2/2]

template<typename T, class DL = DefaultDeleter<T>>
template<class T2 >
ScopedPtr& Common::ScopedPtr< T, DL >::operator= ( ScopedPtr< T2 > &&  other)
inline

Replaces the ScopedPtr with another scoped ScopedPtr.

◆ get()

template<typename T, class DL = DefaultDeleter<T>>
PointerType Common::ScopedPtr< T, DL >::get ( ) const
inline

Returns the plain pointer value.

Returns
the pointer the ScopedPtr manages

◆ release()

template<typename T, class DL = DefaultDeleter<T>>
PointerType Common::ScopedPtr< T, DL >::release ( )
inline

Returns the plain pointer value and releases ScopedPtr. After release() call you need to delete object yourself

Returns
the pointer the ScopedPtr manages

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