TUniqueObj

This is essentially a reference version of [TUniquePtr](API\Runtime\Core\Templates\TUniquePtr) Useful to force heap allocation of a value, e.g. in a [TMap](API\Runtime\Core\Containers\TMap) to give similar behaviour to [TIndirectArray](API\Runtime\Core\Containers\TIndirectArray)

Windows
MacOS
Linux

References

Module

Core

Header

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

Include

#include "Templates/UniqueObj.h"

Syntax

template<typename T>
class TUniqueObj

Remarks

This is essentially a reference version of TUniquePtr Useful to force heap allocation of a value, e.g. in a TMap to give similar behaviour to TIndirectArray

Constructors

Name Description

Public function

TUniqueObj

(
    const TUniqueObj& other
)

Public function

TUniqueObj

(
    TUniqueObj&& other
)

As TUniqueObj's internal pointer can never be null, we can't move that On the other hand we can call the move constructor of "T"

Public function

TUniqueObj

(
    Args&&... args
)

Functions

Name Description

Public function

T &

 

Get()

Public function Const

const T &

 

Get()

Operators

Name Description

Public function

T &

 

operator*()

Public function Const

const T &

 

operator*()

Public function

TUniqueObj &

 

operator=

(
    const TUniqueObj&
)

Disallow copy-assignment.

Public function

TUniqueObj &

 

operator=

(
    TUniqueObj&& other
)

Move-assignment is implemented as swapping the internal pointer.

Public function

TUniqueObj &

 

operator=

(
    Arg&& other
)

Public function

T *

 

operator->()

Public function Const

const T *...

 

operator->()

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