Navigation
API > API/Runtime > API/Runtime/uLangCore > API/Runtime/uLangCore/uLang > API/Runtime/uLangCore/uLang/Common > API/Runtime/uLangCore/uLang/Common/Containers
Inheritance Hierarchy
- TFunctionRefBase
- TFunction
References
| Module | uLangCore |
| Header | /Engine/Source/Runtime/Solaris/uLangCore/Public/uLang/Common/Containers/Function.h |
| Include | #include "uLang/Common/Containers/Function.h" |
Syntax
template<typename FuncType>
class TFunction : public uLang::Private::TFunctionRefBase< Private::TFunctionStorage< false >, FuncType >
Remarks
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" }
Constructors
| Type | Name | Description | |
|---|---|---|---|
TFunction
(
NullPtrType |
Default constructor. | ||
TFunction
(
FunctorType&& InFunc |
Constructor which binds a TFunction to any function object. | ||
Destructors
| Type | Name | Description | |
|---|---|---|---|
~TFunction () |
Functions
| Type | Name | Description | |
|---|---|---|---|
| void | Reset () |
Removes any bound callable from the TFunction, restoring it to the default 'empty' state. |
Operators
| Type | Name | Description | |
|---|---|---|---|
| ULANG_FORCEINLINE | Tests if the TFunction is callable. | ||
| TFunction & | Move assignment operator. | ||
| TFunction & | Copy assignment operator. |
Typedefs
| Name | Description |
|---|---|
| Super |