Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
TUniquePtr< T, Deleter > Class Template Reference

#include <UniquePtr.h>

+ Inheritance diagram for TUniquePtr< T, Deleter >:
+ Collaboration diagram for TUniquePtr< T, Deleter >:

Public Types

using ElementType = T
 

Public Member Functions

 TUniquePtr (const TUniquePtr &)=delete
 
TUniquePtroperator= (const TUniquePtr &)=delete
 
FORCEINLINE TUniquePtr ()
 
template<typename U , typename = decltype(ImplicitConv<T*>((U*)nullptr))>
FORCEINLINE TUniquePtr (U *InPtr)
 
template<typename U , typename = decltype(ImplicitConv<T*>((U*)nullptr))>
FORCEINLINE TUniquePtr (U *InPtr, Deleter &&InDeleter)
 
template<typename U , typename = decltype(ImplicitConv<T*>((U*)nullptr))>
FORCEINLINE TUniquePtr (U *InPtr, const Deleter &InDeleter)
 
FORCEINLINE TUniquePtr (TYPE_OF_NULLPTR)
 
FORCEINLINE TUniquePtr (TUniquePtr &&Other)
 
template<typename OtherT , typename OtherDeleter , typename = typename TEnableIf<!TIsArray<OtherT>::Value>::Type, typename = decltype(ImplicitConv<T*>((OtherT*)nullptr))>
FORCEINLINE TUniquePtr (TUniquePtr< OtherT, OtherDeleter > &&Other)
 
FORCEINLINE TUniquePtroperator= (TUniquePtr &&Other)
 
template<typename OtherT , typename OtherDeleter , typename = typename TEnableIf<!TIsArray<OtherT>::Value>::Type, typename = decltype(ImplicitConv<T*>((OtherT*)nullptr))>
FORCEINLINE TUniquePtroperator= (TUniquePtr< OtherT, OtherDeleter > &&Other)
 
FORCEINLINE TUniquePtroperator= (TYPE_OF_NULLPTR)
 
FORCEINLINE ~TUniquePtr ()
 
bool IsValid () const
 
FORCEINLINE operator bool () const
 
FORCEINLINE bool operator! () const
 
FORCEINLINE Toperator-> () const
 
FORCEINLINE Toperator* () const
 
FORCEINLINE TGet () const
 
FORCEINLINE TRelease ()
 
FORCEINLINE void Reset (T *InPtr=nullptr)
 
FORCEINLINE Deleter & GetDeleter ()
 
FORCEINLINE const Deleter & GetDeleter () const
 
template<typename RhsT >
FORCEINLINE bool operator== (const TUniquePtr< RhsT > &Rhs) const
 
FORCEINLINE bool operator== (TYPE_OF_NULLPTR) const
 
template<typename RhsT >
FORCEINLINE bool operator!= (const TUniquePtr< RhsT > &Rhs) const
 
FORCEINLINE bool operator!= (TYPE_OF_NULLPTR) const
 

Private Types

using PtrType = T*
 

Private Member Functions

 DECLARE_INLINE_TYPE_LAYOUT_EXPLICIT_BASES (TUniquePtr, NonVirtual, Deleter)
 
 LAYOUT_FIELD (PtrType, Ptr)
 
- Private Member Functions inherited from TDefaultDelete< T >
 DECLARE_INLINE_TYPE_LAYOUT (TDefaultDelete, NonVirtual)
 
 TDefaultDelete ()=default
 
 TDefaultDelete (const TDefaultDelete &)=default
 
TDefaultDeleteoperator= (const TDefaultDelete &)=default
 
 ~TDefaultDelete ()=default
 
template<typename U , typename = decltype(ImplicitConv<T*>((U*)nullptr))>
 TDefaultDelete (const TDefaultDelete< U > &)
 
template<typename U , typename = decltype(ImplicitConv<T*>((U*)nullptr))>
TDefaultDeleteoperator= (const TDefaultDelete< U > &)
 
void operator() (T *Ptr) const
 

Friends

template<typename OtherT , typename OtherDeleter >
class TUniquePtr
 

Detailed Description

template<typename T, typename Deleter = TDefaultDelete<T>>
class TUniquePtr< T, Deleter >

Definition at line 104 of file UniquePtr.h.

Member Typedef Documentation

◆ ElementType

template<typename T , typename Deleter = TDefaultDelete<T>>
using TUniquePtr< T, Deleter >::ElementType = T

Definition at line 112 of file UniquePtr.h.

◆ PtrType

template<typename T , typename Deleter = TDefaultDelete<T>>
using TUniquePtr< T, Deleter >::PtrType = T*
private

Definition at line 378 of file UniquePtr.h.

Constructor & Destructor Documentation

◆ TUniquePtr() [1/8]

template<typename T , typename Deleter = TDefaultDelete<T>>
TUniquePtr< T, Deleter >::TUniquePtr ( const TUniquePtr< T, Deleter > & )
delete

◆ TUniquePtr() [2/8]

template<typename T , typename Deleter = TDefaultDelete<T>>
FORCEINLINE TUniquePtr< T, Deleter >::TUniquePtr ( )
inline

Default constructor - initializes the TUniquePtr to null.

Definition at line 121 of file UniquePtr.h.

◆ TUniquePtr() [3/8]

template<typename T , typename Deleter = TDefaultDelete<T>>
template<typename U , typename = decltype(ImplicitConv<T*>((U*)nullptr))>
FORCEINLINE TUniquePtr< T, Deleter >::TUniquePtr ( U * InPtr)
inlineexplicit

Pointer constructor - takes ownership of the pointed-to object

Parameters
InPtrThe pointed-to object to take ownership of.

Definition at line 136 of file UniquePtr.h.

◆ TUniquePtr() [4/8]

template<typename T , typename Deleter = TDefaultDelete<T>>
template<typename U , typename = decltype(ImplicitConv<T*>((U*)nullptr))>
FORCEINLINE TUniquePtr< T, Deleter >::TUniquePtr ( U * InPtr,
Deleter && InDeleter )
inlineexplicit

Pointer constructor - takes ownership of the pointed-to object

Parameters
InPtrThe pointed-to object to take ownership of.

Definition at line 151 of file UniquePtr.h.

◆ TUniquePtr() [5/8]

template<typename T , typename Deleter = TDefaultDelete<T>>
template<typename U , typename = decltype(ImplicitConv<T*>((U*)nullptr))>
FORCEINLINE TUniquePtr< T, Deleter >::TUniquePtr ( U * InPtr,
const Deleter & InDeleter )
inlineexplicit

Pointer constructor - takes ownership of the pointed-to object

Parameters
InPtrThe pointed-to object to take ownership of.

Definition at line 166 of file UniquePtr.h.

◆ TUniquePtr() [6/8]

template<typename T , typename Deleter = TDefaultDelete<T>>
FORCEINLINE TUniquePtr< T, Deleter >::TUniquePtr ( TYPE_OF_NULLPTR )
inline

nullptr constructor - initializes the TUniquePtr to null.

Definition at line 175 of file UniquePtr.h.

◆ TUniquePtr() [7/8]

template<typename T , typename Deleter = TDefaultDelete<T>>
FORCEINLINE TUniquePtr< T, Deleter >::TUniquePtr ( TUniquePtr< T, Deleter > && Other)
inline

Move constructor

Definition at line 184 of file UniquePtr.h.

◆ TUniquePtr() [8/8]

template<typename T , typename Deleter = TDefaultDelete<T>>
template<typename OtherT , typename OtherDeleter , typename = typename TEnableIf<!TIsArray<OtherT>::Value>::Type, typename = decltype(ImplicitConv<T*>((OtherT*)nullptr))>
FORCEINLINE TUniquePtr< T, Deleter >::TUniquePtr ( TUniquePtr< OtherT, OtherDeleter > && Other)
inline

Constructor from rvalues of other (usually derived) types

Definition at line 200 of file UniquePtr.h.

◆ ~TUniquePtr()

template<typename T , typename Deleter = TDefaultDelete<T>>
FORCEINLINE TUniquePtr< T, Deleter >::~TUniquePtr ( )
inline

Destructor

Definition at line 264 of file UniquePtr.h.

Member Function Documentation

◆ DECLARE_INLINE_TYPE_LAYOUT_EXPLICIT_BASES()

template<typename T , typename Deleter = TDefaultDelete<T>>
TUniquePtr< T, Deleter >::DECLARE_INLINE_TYPE_LAYOUT_EXPLICIT_BASES ( TUniquePtr< T, Deleter > ,
NonVirtual ,
Deleter  )
private

◆ Get()

template<typename T , typename Deleter = TDefaultDelete<T>>
FORCEINLINE T * TUniquePtr< T, Deleter >::Get ( ) const
inline

Returns a pointer to the owned object without relinquishing ownership.

Returns
A copy of the pointer to the object owned by the TUniquePtr, or nullptr if no object is being owned.

Definition at line 324 of file UniquePtr.h.

◆ GetDeleter() [1/2]

template<typename T , typename Deleter = TDefaultDelete<T>>
FORCEINLINE Deleter & TUniquePtr< T, Deleter >::GetDeleter ( )
inline

Returns a reference to the deleter subobject.

Returns
A reference to the deleter.

Definition at line 362 of file UniquePtr.h.

◆ GetDeleter() [2/2]

template<typename T , typename Deleter = TDefaultDelete<T>>
FORCEINLINE const Deleter & TUniquePtr< T, Deleter >::GetDeleter ( ) const
inline

Returns a reference to the deleter subobject.

Returns
A reference to the deleter.

Definition at line 372 of file UniquePtr.h.

◆ IsValid()

template<typename T , typename Deleter = TDefaultDelete<T>>
bool TUniquePtr< T, Deleter >::IsValid ( ) const
inline

Tests if the TUniquePtr currently owns an object.

Returns
true if the TUniquePtr currently owns an object, false otherwise.

Definition at line 274 of file UniquePtr.h.

◆ LAYOUT_FIELD()

template<typename T , typename Deleter = TDefaultDelete<T>>
TUniquePtr< T, Deleter >::LAYOUT_FIELD ( PtrType ,
Ptr  )
private

◆ operator bool()

template<typename T , typename Deleter = TDefaultDelete<T>>
FORCEINLINE TUniquePtr< T, Deleter >::operator bool ( ) const
inlineexplicit

operator bool

Returns
true if the TUniquePtr currently owns an object, false otherwise.

Definition at line 284 of file UniquePtr.h.

◆ operator!()

template<typename T , typename Deleter = TDefaultDelete<T>>
FORCEINLINE bool TUniquePtr< T, Deleter >::operator! ( ) const
inline

Logical not operator

Returns
false if the TUniquePtr currently owns an object, true otherwise.

Definition at line 294 of file UniquePtr.h.

◆ operator!=() [1/2]

template<typename T , typename Deleter = TDefaultDelete<T>>
template<typename RhsT >
FORCEINLINE bool TUniquePtr< T, Deleter >::operator!= ( const TUniquePtr< RhsT > & Rhs) const
inline

Inequality comparison operator

Parameters
LhsThe first TUniquePtr to compare.
RhsThe second TUniquePtr to compare.
Returns
false if the two TUniquePtrs are logically substitutable for each other, true otherwise.

Definition at line 418 of file UniquePtr.h.

◆ operator!=() [2/2]

template<typename T , typename Deleter = TDefaultDelete<T>>
FORCEINLINE bool TUniquePtr< T, Deleter >::operator!= ( TYPE_OF_NULLPTR ) const
inline

Inequality comparison operator against nullptr.

Parameters
RhsThe TUniquePtr to compare.
Returns
true if the TUniquePtr is not null, false otherwise.

Definition at line 430 of file UniquePtr.h.

◆ operator*()

template<typename T , typename Deleter = TDefaultDelete<T>>
FORCEINLINE T & TUniquePtr< T, Deleter >::operator* ( ) const
inline

Dereference operator

Returns
A reference to the object owned by the TUniquePtr.

Definition at line 314 of file UniquePtr.h.

◆ operator->()

template<typename T , typename Deleter = TDefaultDelete<T>>
FORCEINLINE T * TUniquePtr< T, Deleter >::operator-> ( ) const
inline

Indirection operator

Returns
A pointer to the object owned by the TUniquePtr.

Definition at line 304 of file UniquePtr.h.

◆ operator=() [1/4]

template<typename T , typename Deleter = TDefaultDelete<T>>
TUniquePtr & TUniquePtr< T, Deleter >::operator= ( const TUniquePtr< T, Deleter > & )
delete

◆ operator=() [2/4]

template<typename T , typename Deleter = TDefaultDelete<T>>
FORCEINLINE TUniquePtr & TUniquePtr< T, Deleter >::operator= ( TUniquePtr< T, Deleter > && Other)
inline

Move assignment operator

Definition at line 210 of file UniquePtr.h.

◆ operator=() [3/4]

template<typename T , typename Deleter = TDefaultDelete<T>>
template<typename OtherT , typename OtherDeleter , typename = typename TEnableIf<!TIsArray<OtherT>::Value>::Type, typename = decltype(ImplicitConv<T*>((OtherT*)nullptr))>
FORCEINLINE TUniquePtr & TUniquePtr< T, Deleter >::operator= ( TUniquePtr< OtherT, OtherDeleter > && Other)
inline

Assignment operator for rvalues of other (usually derived) types

Definition at line 235 of file UniquePtr.h.

◆ operator=() [4/4]

template<typename T , typename Deleter = TDefaultDelete<T>>
FORCEINLINE TUniquePtr & TUniquePtr< T, Deleter >::operator= ( TYPE_OF_NULLPTR )
inline

Nullptr assignment operator

Definition at line 251 of file UniquePtr.h.

◆ operator==() [1/2]

template<typename T , typename Deleter = TDefaultDelete<T>>
template<typename RhsT >
FORCEINLINE bool TUniquePtr< T, Deleter >::operator== ( const TUniquePtr< RhsT > & Rhs) const
inline

Equality comparison operator

Parameters
LhsThe first TUniquePtr to compare.
RhsThe second TUniquePtr to compare.
Returns
true if the two TUniquePtrs are logically substitutable for each other, false otherwise.

Definition at line 391 of file UniquePtr.h.

◆ operator==() [2/2]

template<typename T , typename Deleter = TDefaultDelete<T>>
FORCEINLINE bool TUniquePtr< T, Deleter >::operator== ( TYPE_OF_NULLPTR ) const
inline

Equality comparison operator against nullptr.

Parameters
LhsThe TUniquePtr to compare.
Returns
true if the TUniquePtr is null, false otherwise.

Definition at line 403 of file UniquePtr.h.

◆ Release()

template<typename T , typename Deleter = TDefaultDelete<T>>
FORCEINLINE T * TUniquePtr< T, Deleter >::Release ( )
inline

Relinquishes control of the owned object to the caller and nulls the TUniquePtr.

Returns
The pointer to the object that was owned by the TUniquePtr, or nullptr if no object was being owned.

Definition at line 334 of file UniquePtr.h.

◆ Reset()

template<typename T , typename Deleter = TDefaultDelete<T>>
FORCEINLINE void TUniquePtr< T, Deleter >::Reset ( T * InPtr = nullptr)
inline

Gives the TUniquePtr a new object to own, destroying any previously-owned object.

Parameters
InPtrA pointer to the object to take ownership of.

Definition at line 346 of file UniquePtr.h.

Friends And Related Symbol Documentation

◆ TUniquePtr

template<typename T , typename Deleter = TDefaultDelete<T>>
friend class TUniquePtr
friend

Definition at line 109 of file UniquePtr.h.


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