Ark Server API (ASA) - Wiki
|
#include "CoreTypes.h"
#include "Traits/MemberFunctionPtrOuter.h"
#include "Templates/UnrealTemplate.h"
#include <type_traits>
Go to the source code of this file.
Namespaces | |
namespace | UE |
namespace | UE::Core |
namespace | UE::Core::Private |
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 |
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));
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 |
FORCEINLINE auto Invoke | ( | FuncType && | Func, |
ArgTypes &&... | Args ) -> decltype(Forward<FuncType>(Func)(Forward<ArgTypes>(Args)...)) |
Invokes a callable with a set of arguments. Allows the following:
See: http://en.cppreference.com/w/cpp/utility/functional/invoke
FORCEINLINE auto Invoke | ( | PtrMemFunType | PtrMemFun, |
TargetType && | Target, | ||
ArgTypes &&... | Args ) -> decltype((UE::Core::Private::DereferenceIfNecessary<ObjType>(Forward<TargetType>(Target), &Target).*PtrMemFun)(Forward<ArgTypes>(Args)...)) |
FORCEINLINE auto Invoke | ( | ReturnType ObjType::* | pdm, |
TargetType && | Target ) -> decltype(UE::Core::Private::DereferenceIfNecessary<ObjType>(Forward<TargetType>(Target), &Target).*pdm) |