Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
TUniqueFunction< FuncType > Class Template Reference

#include <Function.h>

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

Public Member Functions

 TUniqueFunction (TYPE_OF_NULLPTR=nullptr)
 
template<typename FunctorType , typename = typename TEnableIf< TAnd< TNot<TOr<TIsTUniqueFunction<typename TDecay<FunctorType>::Type>, TIsTFunction<typename TDecay<FunctorType>::Type>>>, UE::Core::Private::Function::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 ()
 
FORCEINLINE operator bool () const
 

Private Types

using Super = UE::Core::Private::Function::TFunctionRefBase<UE::Core::Private::Function::TFunctionStorage<true>, FuncType>
 

Detailed Description

template<typename FuncType>
class 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 = 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

Definition at line 952 of file Function.h.

Member Typedef Documentation

◆ Super

Definition at line 954 of file Function.h.

Constructor & Destructor Documentation

◆ TUniqueFunction() [1/6]

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

Default constructor.

Definition at line 960 of file Function.h.

◆ 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>>>, UE::Core::Private::Function::TFuncCanBindToFunctor<FuncType, FunctorType> >::Value >::Type>
TUniqueFunction< FuncType >::TUniqueFunction ( FunctorType && InFunc)
inline

Constructor which binds a TFunction to any function object.

Definition at line 976 of file Function.h.

◆ TUniqueFunction() [3/6]

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

Constructor which takes ownership of a TFunction's functor.

Definition at line 995 of file Function.h.

◆ TUniqueFunction() [4/6]

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

Constructor which takes ownership of a TFunction's functor.

Definition at line 1003 of file Function.h.

◆ TUniqueFunction() [5/6]

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

◆ TUniqueFunction() [6/6]

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

◆ ~TUniqueFunction()

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

Member Function Documentation

◆ operator bool()

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

Tests if the TUniqueFunction is callable.

Definition at line 1033 of file Function.h.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

Copy/move assignment operator.

Definition at line 1011 of file Function.h.

◆ Reset()

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

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

Definition at line 1025 of file Function.h.


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