TDefaultDelete

Single-ownership smart pointer in the vein of std::unique_ptr.

Windows
MacOS
Linux

References

Module

Core

Header

/Engine/Source/Runtime/Core/Public/Templates/UniquePtr.h

Include

#include "Templates/UniquePtr.h"

Syntax

template<typename T>
struct TDefaultDelete

Remarks

Single-ownership smart pointer in the vein of std::unique_ptr. Use this when you need an object's lifetime to be strictly bound to the lifetime of a single smart pointer.

This class is non-copyable - ownership can only be transferred via a move operation, e.g.:

TUniquePtr<MyClass> Ptr1(new MyClass); // The MyClass object is owned by Ptr1. TUniquePtr<MyClass> Ptr2(Ptr1); // Error - TUniquePtr is not copyable TUniquePtr<MyClass> Ptr3(MoveTemp(Ptr1)); // Ptr3 now owns the MyClass object - Ptr1 is now nullptr.

If you provide a custom deleter, it is up to your deleter to handle null pointers. This is a departure from std::unique_ptr which will not invoke the deleter if the owned pointer is null: https://en.cppreference.com/w/cpp/memory/unique_ptr/~unique_ptr

Specializations

Constructors

Name Description

Public function

TDefaultDelete()

Public function

TDefaultDelete

(
    const TDefaultDelete&
)

Public function

TDefaultDelete

(
    const TDefaultDelete< U >&
)

Destructors

Name Description

Public function

~TDefaultDelete()

Functions

Name Description

Public function Const

const FTypeL...

 

GetTypeLayout()

Public function Static

FTypeLayoutD...

 

StaticGetTypeLayout()

Operators

Name Description

Public function Const

void

 

operator()

(
    T* Ptr
)

Public function

TDefaultDele...

 

operator=

(
    const TDefaultDelete&
)

Public function

TDefaultDele...

 

operator=

(
    const TDefaultDelete< U >&
)

Classes

Name

Description

Public struct

InternalLinkType

Typedefs

Name

Description

DerivedType

InternalBaseType

Constants

Name

Description

CounterBase

InterfaceType

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss