TUniqueFunction

TUniqueFunction

Windows
MacOS
Linux

Inheritance Hierarchy

TFunctionRefBase

TUniqueFunction

References

Module

Core

Header

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

Include

#include "Templates/Function.h"

Syntax

Remarks

TUniqueFunction<FuncType>

See the class definition for intended usage.

TUniqueFunction<FuncType>

Used like TFunction above, but is move-only. This allows non-copyable functors to be bound to it.

Example:

TUniquePtr<FThing> Thing = MakeUnique<FThing>() ;

TFunction <void() > CopyableFunc = [Thing = MoveTemp(Thing)](){ Thing>DoSomething(); }; // error lambda is not copyable TUniqueFunction<void()> MovableFunc = [Thing = MoveTemp(Thing)](){ Thing->DoSomething(); }; // ok

void Foo(TUniqueFunction<void()> Func); Foo(MovableFunc); // error - TUniqueFunction is not copyable Foo(MoveTemp(MovableFunc)); // ok

Constructors

Name Description

Public function

TUniqueFunction

(
    TYPE_OF_NULLPTR
)

Default constructor.

Public function

TUniqueFunction

(
    FunctorType&& InFunc
)

Constructor which binds a TFunction to any function object.

Public function

TUniqueFunction

(
    TFunction < FuncType >&& Other
)

Constructor which takes ownership of a TFunction 's functor.

Public function

TUniqueFunction

(
    const TFunction < FuncType >& Other
)

Constructor which takes ownership of a TFunction 's functor.

Public function

TUniqueFunction

(
    TUniqueFunction &&
)

Public function

TUniqueFunction

(
    const TUniqueFunction & Other
)

Destructors

Name Description

Public function

~TUniqueFunction()

Operators

Name Description

Public function Const

FORCEINLINE

 

operator bool()

Tests if the TUniqueFunction is callable.

Public function

TUniqueFunct ...

 

operator=

(
    TUniqueFunction && Other
)

Copy/move assignment operator.

Public function

TUniqueFunct ...

 

operator=

(
    const TUniqueFunction & Other
)

Typedefs

Name

Description

Super

Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback