![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include "CoreTypes.h"#include "AutoRTFM.h"#include "Traits/MemberFunctionPtrOuter.h"#include <type_traits>Go to the source code of this file.
Namespaces | |
| namespace | UE |
| namespace | UE::Core |
| namespace | UE::Core::Private |
| implementation | |
Macros | |
| #define | UE_PROJECTION(FuncName) |
| #define | UE_PROJECTION_MEMBER(Type, FuncName) |
Typedefs | |
| template<typename FuncType , typename... ArgTypes> | |
| using | TInvokeResult_T = typename TInvokeResult< FuncType, ArgTypes... >::Type |
Functions | |
| template<typename OuterType , typename TargetType > | |
| constexpr auto | UE::Core::Private::DereferenceIfNecessary (TargetType &&Target, const volatile OuterType *TargetPtr) -> decltype((TargetType &&) Target) |
| template<typename OuterType , typename TargetType > | |
| constexpr auto | UE::Core::Private::DereferenceIfNecessary (TargetType &&Target,...) -> decltype(*(TargetType &&) Target) |
| template<typename FuncType , typename... ArgTypes> | |
| AUTORTFM_INFER UE_FORCEINLINE_HINT constexpr auto | Invoke (FuncType &&Func, ArgTypes &&... Args) -> decltype(((FuncType &&) Func)((ArgTypes &&) Args...)) |
| template<typename ReturnType , typename ObjType , typename TargetType > | |
| AUTORTFM_INFER constexpr auto | Invoke (ReturnType ObjType::*pdm, TargetType &&Target) -> decltype(UE::Core::Private::DereferenceIfNecessary< ObjType >((TargetType &&) Target, &Target).*pdm) |
| template<typename PtrMemFunType , typename TargetType , typename... ArgTypes, typename ObjType = TMemberFunctionPtrOuter_T<PtrMemFunType>> | |
| AUTORTFM_INFER constexpr auto | Invoke (PtrMemFunType PtrMemFun, TargetType &&Target, ArgTypes &&... Args) -> decltype((UE::Core::Private::DereferenceIfNecessary< ObjType >((TargetType &&) Target, &Target).*PtrMemFun)((ArgTypes &&) Args...)) |
| #define UE_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, UE_PROJECTION(LexToString));
| #define UE_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, UE_PROJECTION_MEMBER(UObject, GetFullName));
| using TInvokeResult_T = typename TInvokeResult<FuncType, ArgTypes...>::Type |
|
constexpr |
Invokes a callable with a set of arguments. Allows the following:
See: http://en.cppreference.com/w/cpp/utility/functional/invoke
|
constexpr |