UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
UniquePtr.h File Reference
#include "CoreTypes.h"
#include "Templates/UnrealTemplate.h"
#include "Templates/IsArray.h"
#include "Templates/RemoveExtent.h"
#include "Templates/Requires.h"
#include "Serialization/MemoryLayout.h"
#include <type_traits>

Go to the source code of this file.

Classes

struct  TDefaultDelete< T >
 
struct  TDefaultDelete< T[]>
 
class  TUniquePtr< T, Deleter >
 
class  TUniquePtr< T[], Deleter >
 
struct  TIsZeroConstructType< TUniquePtr< T > >
 
struct  TIsBitwiseConstructible< TUniquePtr< T >, T * >
 

Functions

template<typename T >
UE_FORCEINLINE_HINT bool operator== (TYPE_OF_NULLPTR, const TUniquePtr< T > &Rhs)
 
template<typename T >
UE_FORCEINLINE_HINT bool operator!= (TYPE_OF_NULLPTR, const TUniquePtr< T > &Rhs)
 
template<typename T , typename... TArgs>
UE_FORCEINLINE_HINT TUniquePtr< T > MakeUnique (TArgs &&... Args)
 
template<typename T , typename... TArgs>
UE_FORCEINLINE_HINT TUniquePtr< T > MakeUniqueForOverwrite ()
 
template<typename T >
TUniquePtr< T > MakeUnique (SIZE_T Size)
 
template<typename T >
TUniquePtr< T > MakeUniqueForOverwrite (SIZE_T Size)
 
template<typename T , typename... TArgs>
TUniquePtr< T > MakeUnique (TArgs &&... Args)=delete
 

Variables

template<typename T >
constexpr bool TIsTUniquePtr_V = false
 
template<typename T , typename Deleter >
constexpr bool TIsTUniquePtr_V< TUniquePtr< T, Deleter > > = true
 
template<typename T , typename Deleter >
constexpr bool TIsTUniquePtr_V< const TUniquePtr< T, Deleter > > = true
 
template<typename T , typename Deleter >
constexpr bool TIsTUniquePtr_V< volatile TUniquePtr< T, Deleter > > = true
 
template<typename T , typename Deleter >
constexpr bool TIsTUniquePtr_V< const volatile TUniquePtr< T, Deleter > > = true
 

Function Documentation

◆ MakeUnique() [1/3]

template<typename T >
TUniquePtr< T > MakeUnique ( SIZE_T  Size)
inline

Allocates a new array of type T with the given size and returns it as a TUniquePtr. Only enabled for array-type TUniquePtrs. Elements are value-initialized, which will call a user-defined default constructor if it exists, but causes trivial types to be zeroed.

Parameters
SizeThe size of the array to allocate.
Returns
A TUniquePtr which points to a newly-constructed T array of the specified Size.

◆ MakeUnique() [2/3]

template<typename T , typename... TArgs>
UE_FORCEINLINE_HINT TUniquePtr< T > MakeUnique ( TArgs &&...  Args)
delete

Allocates a new object of type T with the given arguments and returns it as a TUniquePtr. Disabled for array-type TUniquePtrs. The object is value-initialized, which will call a user-defined default constructor if it exists, but a trivial type will be zeroed.

Parameters
ArgsThe arguments to pass to the constructor of T.
Returns
A TUniquePtr which points to a newly-constructed T with the specified Args.

◆ MakeUnique() [3/3]

template<typename T , typename... TArgs>
TUniquePtr< T > MakeUnique ( TArgs &&...  Args)
delete

Overload to cause a compile error when MakeUnique<T[N]> is attempted. Use MakeUnique<T>(N) instead.

Allocates a new object of type T with the given arguments and returns it as a TUniquePtr. Disabled for array-type TUniquePtrs. The object is value-initialized, which will call a user-defined default constructor if it exists, but a trivial type will be zeroed.

Parameters
ArgsThe arguments to pass to the constructor of T.
Returns
A TUniquePtr which points to a newly-constructed T with the specified Args.

◆ MakeUniqueForOverwrite() [1/2]

template<typename T , typename... TArgs>
UE_FORCEINLINE_HINT TUniquePtr< T > MakeUniqueForOverwrite ( )

Allocates a new object of type T with the given arguments and returns it as a TUniquePtr. Disabled for array-type TUniquePtrs. The object is default-initialized, which will call a user-defined default constructor if it exists, but a trivial type will be uninitialized.

Parameters
ArgsThe arguments to pass to the constructor of T.
Returns
A TUniquePtr which points to a newly-constructed T with the specified Args.

◆ MakeUniqueForOverwrite() [2/2]

template<typename T >
TUniquePtr< T > MakeUniqueForOverwrite ( SIZE_T  Size)
inline

Allocates a new array of type T with the given size and returns it as a TUniquePtr. Only enabled for array-type TUniquePtrs. Elements are default-initialized, which will call a user-defined default constructor if it exists, but causes trivial types to be left uninitialized.

Parameters
SizeThe size of the array to allocate.
Returns
A TUniquePtr which points to a newly-constructed T array of the specified Size.

◆ operator!=()

template<typename T >
UE_FORCEINLINE_HINT bool operator!= ( TYPE_OF_NULLPTR  ,
const TUniquePtr< T > &  Rhs 
)

◆ operator==()

template<typename T >
UE_FORCEINLINE_HINT bool operator== ( TYPE_OF_NULLPTR  ,
const TUniquePtr< T > &  Rhs 
)

Variable Documentation

◆ TIsTUniquePtr_V

template<typename T >
constexpr bool TIsTUniquePtr_V = false
constexpr

Trait which determines whether or not a type is a TUniquePtr.

◆ TIsTUniquePtr_V< const TUniquePtr< T, Deleter > >

template<typename T , typename Deleter >
constexpr bool TIsTUniquePtr_V< const TUniquePtr< T, Deleter > > = true
constexpr

◆ TIsTUniquePtr_V< const volatile TUniquePtr< T, Deleter > >

template<typename T , typename Deleter >
constexpr bool TIsTUniquePtr_V< const volatile TUniquePtr< T, Deleter > > = true
constexpr

◆ TIsTUniquePtr_V< TUniquePtr< T, Deleter > >

template<typename T , typename Deleter >
constexpr bool TIsTUniquePtr_V< TUniquePtr< T, Deleter > > = true
constexpr

◆ TIsTUniquePtr_V< volatile TUniquePtr< T, Deleter > >

template<typename T , typename Deleter >
constexpr bool TIsTUniquePtr_V< volatile TUniquePtr< T, Deleter > > = true
constexpr