TUniqueFunction<FuncType> 更多...
#include <Function.h>
类 TUniqueFunction< FuncType > 继承关系图:Public 成员函数 | |
| FORCEINLINE | operator bool () const |
| Tests if the TUniqueFunction is callable. | |
| TUniqueFunction & | operator= (TUniqueFunction &&Other) |
| Copy/move assignment operator. | |
| TUniqueFunction (const TFunction< FuncType > &Other) | |
| Constructor which takes ownership of a TFunction's functor. | |
| template<typename FunctorType , typename = typename TEnableIf< TAnd< TNot<TOr<TIsTUniqueFunction<typename TDecay<FunctorType>::Type>, TIsTFunction<typename TDecay<FunctorType>::Type>>>, UE4Function_Private::TFuncCanBindToFunctor<FuncType, FunctorType> >::Value >::Type> | |
| TUniqueFunction (FunctorType &&InFunc) | |
| Constructor which binds a TFunction to any function object. | |
| TUniqueFunction (TFunction< FuncType > &&Other) | |
| Constructor which takes ownership of a TFunction's functor. | |
| TUniqueFunction (TYPE_OF_NULLPTR=nullptr) | |
| Default constructor. | |
TUniqueFunction<FuncType>
See the class definition for intended usage.
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