UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
uLang::TUniqueFunction< FuncType > Class Template Reference

#include <Function.h>

+ Inheritance diagram for uLang::TUniqueFunction< FuncType >:

Public Member Functions

 TUniqueFunction (NullPtrType=nullptr)
 
template<typename FunctorType , typename = typename TEnableIf< TAnd< TNot<TOr<TIsTUniqueFunction<typename TDecay<FunctorType>::Type>, TIsTFunction<typename TDecay<FunctorType>::Type>>>, Private::TFuncCanBindToFunctor<FuncType, FunctorType> >::Value >::Type>
 TUniqueFunction (FunctorType &&InFunc)
 
 TUniqueFunction (TFunction< FuncType > &&Other)
 
 TUniqueFunction (const TFunction< FuncType > &Other)
 
TUniqueFunctionoperator= (TUniqueFunction &&Other)
 
 TUniqueFunction (TUniqueFunction &&)=default
 
 TUniqueFunction (const TUniqueFunction &Other)=delete
 
TUniqueFunctionoperator= (const TUniqueFunction &Other)=delete
 
 ~TUniqueFunction ()=default
 
void Reset ()
 
ULANG_FORCEINLINE operator bool () const
 

Detailed Description

template<typename FuncType>
class uLang::TUniqueFunction< FuncType >

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 = Move(Thing)](){ Thing->DoSomething(); }; // error - lambda is not copyable TUniqueFunction<void()> MovableFunc = [Thing = Move(Thing)](){ Thing->DoSomething(); }; // ok

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

Constructor & Destructor Documentation

◆ TUniqueFunction() [1/6]

template<typename FuncType >
uLang::TUniqueFunction< FuncType >::TUniqueFunction ( NullPtrType  = nullptr)
inline

Default constructor.

◆ TUniqueFunction() [2/6]

template<typename FuncType >
template<typename FunctorType , typename = typename TEnableIf< TAnd< TNot<TOr<TIsTUniqueFunction<typename TDecay<FunctorType>::Type>, TIsTFunction<typename TDecay<FunctorType>::Type>>>, Private::TFuncCanBindToFunctor<FuncType, FunctorType> >::Value >::Type>
uLang::TUniqueFunction< FuncType >::TUniqueFunction ( FunctorType &&  InFunc)
inline

Constructor which binds a TFunction to any function object.

◆ TUniqueFunction() [3/6]

template<typename FuncType >
uLang::TUniqueFunction< FuncType >::TUniqueFunction ( TFunction< FuncType > &&  Other)
inline

Constructor which takes ownership of a TFunction's functor.

◆ TUniqueFunction() [4/6]

template<typename FuncType >
uLang::TUniqueFunction< FuncType >::TUniqueFunction ( const TFunction< FuncType > &  Other)
inline

Constructor which takes ownership of a TFunction's functor.

◆ TUniqueFunction() [5/6]

template<typename FuncType >
uLang::TUniqueFunction< FuncType >::TUniqueFunction ( TUniqueFunction< FuncType > &&  )
default

◆ TUniqueFunction() [6/6]

template<typename FuncType >
uLang::TUniqueFunction< FuncType >::TUniqueFunction ( const TUniqueFunction< FuncType > &  Other)
delete

◆ ~TUniqueFunction()

template<typename FuncType >
uLang::TUniqueFunction< FuncType >::~TUniqueFunction ( )
default

Member Function Documentation

◆ operator bool()

template<typename FuncType >
ULANG_FORCEINLINE uLang::TUniqueFunction< FuncType >::operator bool ( ) const
inlineexplicit

Tests if the TUniqueFunction is callable.

◆ operator=() [1/2]

template<typename FuncType >
TUniqueFunction & uLang::TUniqueFunction< FuncType >::operator= ( const TUniqueFunction< FuncType > &  Other)
delete

◆ operator=() [2/2]

template<typename FuncType >
TUniqueFunction & uLang::TUniqueFunction< FuncType >::operator= ( TUniqueFunction< FuncType > &&  Other)
inline

Copy/move assignment operator.

◆ Reset()

template<typename FuncType >
void uLang::TUniqueFunction< FuncType >::Reset ( )
inline

Removes any bound callable from the TFunction, restoring it to the default 'empty' state.


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