Navigation
API > API/Runtime > API/Runtime/uLangCore
TFunction
See the class definition for intended usage.
TFunction
A class which represents a copy of something callable. FuncType represents a function type and so TFunction should be defined as follows:
// A function taking a string and float and returning int32. Parameter names are optional. TFunction
Unlike TFunctionRef, this object is intended to be used like a UE version of std::function. That is, it takes a copy of whatever is bound to it, meaning you can return it from functions and store them in objects without caring about the lifetime of the original object being bound.
Example:
// Something.h TFunction
// Something.cpp TFunction
// SomewhereElse.cpp #include "Something.h"
void Func() { TFunction
FString Result = Transform(5); // "Hello: 25" }
| Name | TFunction |
| Type | class |
| Header File | /Engine/Source/Runtime/Solaris/uLangCore/Public/uLang/Common/Containers/Function.h |
| Include Path | #include "uLang/Common/Containers/Function.h" |
Syntax
template<typename FuncType>
class TFunction : public uLang::Private::TFunctionRefBase< Private::TFunctionStorage< false >, FuncType >
Inheritance Hierarchy
- TFunctionRefBase → TFunction
- TFunction
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
TFunction
(
NullPtrType |
Default constructor. | uLang/Common/Containers/Function.h | |
TFunction
(
FunctorType&& InFunc |
Constructor which binds a TFunction to any function object. | uLang/Common/Containers/Function.h | |
| uLang/Common/Containers/Function.h | |||
| uLang/Common/Containers/Function.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
~TFunction() |
uLang/Common/Containers/Function.h |
Typedefs
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| Super | Private::TFunctionRefBase< Private::TFunctionStorage< false >, FuncType > | uLang/Common/Containers/Function.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void Reset() |
Removes any bound callable from the TFunction, restoring it to the default 'empty' state. | uLang/Common/Containers/Function.h |
Operators
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
ULANG_FORCEINLINE operator bool() |
Tests if the TFunction is callable. | uLang/Common/Containers/Function.h | |
| Move assignment operator. | uLang/Common/Containers/Function.h | ||
| Copy assignment operator. | uLang/Common/Containers/Function.h |