MCRO
C++23 utilities for Unreal Engine.
Loading...
Searching...
No Matches
Mcro::FunctionTraits Namespace Reference

Namespaces

namespace  Detail
 

Data Structures

struct  TDeferFunctionArguments
 Defers a set of arguments for a function call later with its first argument. This is useful for developing fluent API operators. More...
 
struct  TFunctionTraits
 Get signature information about any function declaring type (function pointer or functor structs including lambda functions). It should be used in other templates. More...
 
struct  TFunctionTraits< ReturnIn(*)(Args...)>
 Specialization extracting the types from the compound function pointer type. More...
 
struct  TFunctionTraits< ReturnIn(Args...)>
 Specialization extracting the types from the compound function type. More...
 
struct  TFunctionTraits< ReturnIn(ClassIn::*)(Args...) const >
 Specialization extracting the types from the compound function pointer type of a const member function. More...
 
struct  TFunctionTraits< ReturnIn(ClassIn::*)(Args...)>
 Specialization extracting the types from the compound function pointer type of a member function. More...
 
struct  TFunctionTraits< T >
 Specialization for functor structs / lambda functions. More...
 

Concepts

concept  CFunctorObject
 Concept constraining input T to a lambda function or a functor object.
 
concept  CFunction_IsMember
 
concept  CFunction_IsConst
 Shorthand for getting the constness of a member function.
 
concept  CFunctionLike
 A concept accepting any function like entity (function pointer or functor object)
 
concept  CFunctionPtr
 A concept accepting function pointer types.
 
concept  CHasFunction
 
concept  CTupleCompatibleWithFunction
 Is given tuple type compatible with the arguments of the given function?
 
concept  CFunctionCompatible_ReturnDecay
 Concept matching the return of a type with compatible return types, disregarding CV-ref qualifiers.
 
concept  CFunctionCompatible_Return
 Concept matching the return of a type with compatible return types, preserving CV-ref qualifiers.
 
concept  CFunctionCompatible_ArgumentsDecay
 Concept matching function types with compatible set of arguments, disregarding CV-ref qualifiers.
 
concept  CFunctionCompatible_Arguments
 Concept matching function types with compatible set of arguments, preserving CV-ref qualifiers.
 
concept  CFunctionCompatibleDecay
 Concept constraining a function type to another one which arguments and return types are compatible, disregarding CV-ref qualifiers.
 
concept  CFunctionCompatible
 Concept constraining a function type to another one which arguments and return types are compatible, preserving CV-ref qualifiers.
 
concept  CFunctionWithArgumentCount
 Accept only functions which has given number of arguments, whatever type they may be.
 
concept  CNullaryFunction
 Accept only functions which has 0 arguments.
 
concept  CFunctionReturnsVoid
 Concept matching function types returning void.
 
concept  CInstanceMethod
 Tests if a provided class member function pointer instance (not type!) is indeed an instance member method. Negating it can assume static class member function.
 

Typedefs

template<typename T >
using TFunction_Arguments = typename TFunctionTraits<std::decay_t<T>>::Arguments
 Shorthand for getting a list representing the function arguments.
 
template<typename T >
using TFunction_ArgumentsDecay = typename TFunctionTraits<std::decay_t<T>>::ArgumentsDecay
 Shorthand for getting a list representing the decayed function arguments.
 
template<typename T >
using TFunction_ArgumentsTuple = typename TFunctionTraits<std::decay_t<T>>::ArgumentsTuple
 Shorthand for getting a list representing the function arguments.
 
template<typename T >
using TFunction_ArgumentsTupleDecay = typename TFunctionTraits<std::decay_t<T>>::ArgumentsTupleDecay
 Shorthand for getting a list representing the decayed function arguments.
 
template<typename T >
using TFunction_ArgumentsStd = typename TFunctionTraits<std::decay_t<T>>::ArgumentsStd
 Shorthand for getting a list representing the function arguments.
 
template<typename T >
using TFunction_ArgumentsStdDecay = typename TFunctionTraits<std::decay_t<T>>::ArgumentsStdDecay
 Shorthand for getting a list representing the decayed function arguments.
 
template<typename T >
using TFunction_ArgumentsRangeV3 = typename TFunctionTraits<std::decay_t<T>>::ArgumentsRangeV3
 Shorthand for getting a list representing the function arguments.
 
template<typename T >
using TFunction_ArgumentsRangeV3Decay = typename TFunctionTraits<std::decay_t<T>>::ArgumentsRangeV3Decay
 Shorthand for getting a list representing the decayed function arguments.
 
template<typename T , int I>
using TFunction_Arg = typename TFunctionTraits<std::decay_t<T>>::template Arg<I>
 Shorthand for getting a type of a function argument at given position I.
 
template<typename T , int I>
using TFunction_ArgDecay = typename TFunctionTraits<std::decay_t<T>>::template ArgDecay<I>
 Shorthand for getting a decayed type of a function argument at given position I.
 
template<typename T >
using TFunction_Return = typename TFunctionTraits<std::decay_t<T>>::Return
 Shorthand for getting a function return type.
 
template<typename T >
using TFunction_ReturnDecay = typename TFunctionTraits<std::decay_t<T>>::Return
 Shorthand for getting a function return type discarding qualifiers.
 
template<typename T >
using TFunction_Signature = typename TFunctionTraits<std::decay_t<T>>::Signature
 Shorthand for getting a pur function signature.
 
template<CFunction_IsMember T>
using TFunction_Class = typename TFunctionTraits<std::decay_t<T>>::Class
 Shorthand for getting the class of a member function.
 
template<typename Return , typename TypeList >
using TFunctionFromTypes = typename Detail::TFunctionFromTypes_Struct<Return, std::decay_t<TypeList>>::Type
 Compose a function type from a tuple of arguments and a return type.
 
template<typename Return , typename DstFunction >
using TSetReturn = TFunctionFromTypes<Return, TFunction_Arguments<DstFunction>>
 Override the return type of an input function signature.
 
template<typename Return , typename DstFunction >
using TSetReturnDecay = TFunctionFromTypes<std::decay_t<Return>, TFunction_Arguments<DstFunction>>
 Override the return type of an input function signature, and discard its qualifiers.
 
template<typename SrcFunction , typename DstFunction >
using TCopyReturn = TSetReturn<TFunction_Return<SrcFunction>, DstFunction>
 Copy the return type from source function signature to the destination one.
 
template<typename SrcFunction , typename DstFunction >
using TCopyReturnDecay = TSetReturnDecay<TFunction_ReturnDecay<SrcFunction>, DstFunction>
 Copy the return type from source function signature to the destination one, and discard its qualifiers.
 

Functions

template<typename Function , CTupleCompatibleWithFunction< Function > Tuple>
TFunction_Return< Function > InvokeWithTuple (Function &&function, Tuple &&arguments)
 A clone of std::apply for Unreal, STL and RangeV3 tuples which also supports function pointers.
 
template<CFunctionPtr Function, CHasFunction< Function > Object, CTupleCompatibleWithFunction< Function > Tuple>
TFunction_Return< Function > InvokeWithTuple (Object *object, Function &&function, Tuple &&arguments)
 A clone of std::apply for Unreal, STL and RangeV3 tuples which also supports function pointers. This overload can bind an object.
 

Variables

template<typename T >
constexpr size_t TFunction_ArgCount = TFunctionTraits<std::decay_t<T>>::ArgumentCount
 Shorthand for getting a function argument count.
 

Typedef Documentation

◆ TCopyReturn

template<typename SrcFunction , typename DstFunction >
using Mcro::FunctionTraits::TCopyReturn = TSetReturn<TFunction_Return<SrcFunction>, DstFunction>

Copy the return type from source function signature to the destination one.

Definition at line 258 of file FunctionTraits.h.

◆ TCopyReturnDecay

template<typename SrcFunction , typename DstFunction >
using Mcro::FunctionTraits::TCopyReturnDecay = TSetReturnDecay<TFunction_ReturnDecay<SrcFunction>, DstFunction>

Copy the return type from source function signature to the destination one, and discard its qualifiers.

Definition at line 262 of file FunctionTraits.h.

◆ TFunction_Arg

template<typename T , int I>
using Mcro::FunctionTraits::TFunction_Arg = typename TFunctionTraits<std::decay_t<T>>::template Arg<I>

Shorthand for getting a type of a function argument at given position I.

Definition at line 183 of file FunctionTraits.h.

◆ TFunction_ArgDecay

template<typename T , int I>
using Mcro::FunctionTraits::TFunction_ArgDecay = typename TFunctionTraits<std::decay_t<T>>::template ArgDecay<I>

Shorthand for getting a decayed type of a function argument at given position I.

Definition at line 187 of file FunctionTraits.h.

◆ TFunction_Arguments

template<typename T >
using Mcro::FunctionTraits::TFunction_Arguments = typename TFunctionTraits<std::decay_t<T>>::Arguments

Shorthand for getting a list representing the function arguments.

Definition at line 151 of file FunctionTraits.h.

◆ TFunction_ArgumentsDecay

template<typename T >
using Mcro::FunctionTraits::TFunction_ArgumentsDecay = typename TFunctionTraits<std::decay_t<T>>::ArgumentsDecay

Shorthand for getting a list representing the decayed function arguments.

Definition at line 155 of file FunctionTraits.h.

◆ TFunction_ArgumentsRangeV3

template<typename T >
using Mcro::FunctionTraits::TFunction_ArgumentsRangeV3 = typename TFunctionTraits<std::decay_t<T>>::ArgumentsRangeV3

Shorthand for getting a list representing the function arguments.

Definition at line 175 of file FunctionTraits.h.

◆ TFunction_ArgumentsRangeV3Decay

template<typename T >
using Mcro::FunctionTraits::TFunction_ArgumentsRangeV3Decay = typename TFunctionTraits<std::decay_t<T>>::ArgumentsRangeV3Decay

Shorthand for getting a list representing the decayed function arguments.

Definition at line 179 of file FunctionTraits.h.

◆ TFunction_ArgumentsStd

template<typename T >
using Mcro::FunctionTraits::TFunction_ArgumentsStd = typename TFunctionTraits<std::decay_t<T>>::ArgumentsStd

Shorthand for getting a list representing the function arguments.

Definition at line 167 of file FunctionTraits.h.

◆ TFunction_ArgumentsStdDecay

template<typename T >
using Mcro::FunctionTraits::TFunction_ArgumentsStdDecay = typename TFunctionTraits<std::decay_t<T>>::ArgumentsStdDecay

Shorthand for getting a list representing the decayed function arguments.

Definition at line 171 of file FunctionTraits.h.

◆ TFunction_ArgumentsTuple

template<typename T >
using Mcro::FunctionTraits::TFunction_ArgumentsTuple = typename TFunctionTraits<std::decay_t<T>>::ArgumentsTuple

Shorthand for getting a list representing the function arguments.

Definition at line 159 of file FunctionTraits.h.

◆ TFunction_ArgumentsTupleDecay

template<typename T >
using Mcro::FunctionTraits::TFunction_ArgumentsTupleDecay = typename TFunctionTraits<std::decay_t<T>>::ArgumentsTupleDecay

Shorthand for getting a list representing the decayed function arguments.

Definition at line 163 of file FunctionTraits.h.

◆ TFunction_Class

template<CFunction_IsMember T>
using Mcro::FunctionTraits::TFunction_Class = typename TFunctionTraits<std::decay_t<T>>::Class

Shorthand for getting the class of a member function.

Definition at line 210 of file FunctionTraits.h.

◆ TFunction_Return

template<typename T >
using Mcro::FunctionTraits::TFunction_Return = typename TFunctionTraits<std::decay_t<T>>::Return

Shorthand for getting a function return type.

Definition at line 195 of file FunctionTraits.h.

◆ TFunction_ReturnDecay

template<typename T >
using Mcro::FunctionTraits::TFunction_ReturnDecay = typename TFunctionTraits<std::decay_t<T>>::Return

Shorthand for getting a function return type discarding qualifiers.

Definition at line 199 of file FunctionTraits.h.

◆ TFunction_Signature

template<typename T >
using Mcro::FunctionTraits::TFunction_Signature = typename TFunctionTraits<std::decay_t<T>>::Signature

Shorthand for getting a pur function signature.

Definition at line 203 of file FunctionTraits.h.

◆ TFunctionFromTypes

template<typename Return , typename TypeList >
using Mcro::FunctionTraits::TFunctionFromTypes = typename Detail::TFunctionFromTypes_Struct<Return, std::decay_t<TypeList>>::Type

Compose a function type from a tuple of arguments and a return type.

Definition at line 246 of file FunctionTraits.h.

◆ TSetReturn

template<typename Return , typename DstFunction >
using Mcro::FunctionTraits::TSetReturn = TFunctionFromTypes<Return, TFunction_Arguments<DstFunction>>

Override the return type of an input function signature.

Definition at line 250 of file FunctionTraits.h.

◆ TSetReturnDecay

template<typename Return , typename DstFunction >
using Mcro::FunctionTraits::TSetReturnDecay = TFunctionFromTypes<std::decay_t<Return>, TFunction_Arguments<DstFunction>>

Override the return type of an input function signature, and discard its qualifiers.

Definition at line 254 of file FunctionTraits.h.

Function Documentation

◆ InvokeWithTuple() [1/2]

template<typename Function , CTupleCompatibleWithFunction< Function > Tuple>
TFunction_Return< Function > Mcro::FunctionTraits::InvokeWithTuple ( Function && function,
Tuple && arguments )

A clone of std::apply for Unreal, STL and RangeV3 tuples which also supports function pointers.

TL;DR: It calls a function with arguments supplied from a tuple.

Definition at line 308 of file FunctionTraits.h.

◆ InvokeWithTuple() [2/2]

template<CFunctionPtr Function, CHasFunction< Function > Object, CTupleCompatibleWithFunction< Function > Tuple>
TFunction_Return< Function > Mcro::FunctionTraits::InvokeWithTuple ( Object * object,
Function && function,
Tuple && arguments )

A clone of std::apply for Unreal, STL and RangeV3 tuples which also supports function pointers. This overload can bind an object.

TL;DR: It calls a function with arguments supplied from a tuple.

Definition at line 328 of file FunctionTraits.h.

Variable Documentation

◆ TFunction_ArgCount

template<typename T >
size_t Mcro::FunctionTraits::TFunction_ArgCount = TFunctionTraits<std::decay_t<T>>::ArgumentCount
inlineconstexpr

Shorthand for getting a function argument count.

Definition at line 191 of file FunctionTraits.h.