![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include "uLang/Common/Common.h"#include "uLang/Common/Templates/References.h"#include "uLang/Common/Templates/TypeTraits.h"Go to the source code of this file.
Namespaces | |
| namespace | uLang |
| namespace | uLang::Private |
Macros | |
| #define | ULANG_PROJECTION(FuncName) |
| #define | ULANG_PROJECTION_MEMBER(Type, FuncName) |
| #define ULANG_PROJECTION | ( | FuncName | ) |
Wraps up a named non-member function so that it can easily be passed as a callable. This allows functions with overloads or default arguments to be treated correctly.
Example:
TArray<FMyType> Array = ...;
// Doesn't compile, because you can't take the address of an overloaded function when its type needs to be deduced. Algo::SortBy(Array, &LexToString);
// Works as expected Algo::SortBy(Array, PROJECTION(LexToString));
| #define ULANG_PROJECTION_MEMBER | ( | Type, | |
| FuncName | |||
| ) |
Wraps up a named member function so that it can easily be passed as a callable. This allows functions with overloads or default arguments to be treated correctly.
Example:
TArray<UObject*> Array = ...;
// Doesn't compile, because &UObject::GetFullName loses the default argument and passes // FString (UObject::*)(const UObject*) to Algo::SortBy<>(), which is not a valid projection. Algo::SortBy(Array, &UObject::GetFullName);
// Works as expected Algo::SortBy(Array, PROJECTION_MEMBER(UObject, GetFullName));