MCRO
C++23 utilities for Unreal Engine.
Loading...
Searching...
No Matches
FunctionTraits.h File Reference
#include <utility>
#include "CoreMinimal.h"
#include "Mcro/Tuples.h"
#include "Mcro/Concepts.h"

Go to the source code of this file.

Data Structures

struct  Mcro::FunctionTraits::Detail::TFunctionMeta< ReturnIn, Args >
 
struct  Mcro::FunctionTraits::TFunctionTraits< T >
 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  Mcro::FunctionTraits::TFunctionTraits< T >
 Specialization for functor structs / lambda functions. More...
 
struct  Mcro::FunctionTraits::TFunctionTraits< ReturnIn(ClassIn::*)(Args...) const >
 Specialization extracting the types from the compound function pointer type of a const member function. More...
 
struct  Mcro::FunctionTraits::TFunctionTraits< ReturnIn(ClassIn::*)(Args...)>
 Specialization extracting the types from the compound function pointer type of a member function. More...
 
struct  Mcro::FunctionTraits::TFunctionTraits< ReturnIn(*)(Args...)>
 Specialization extracting the types from the compound function pointer type. More...
 
struct  Mcro::FunctionTraits::TFunctionTraits< ReturnIn(Args...)>
 Specialization extracting the types from the compound function type. More...
 
struct  Mcro::FunctionTraits::Detail::TFunctionFromTuple_Struct< Return, Tuple >
 
struct  Mcro::FunctionTraits::TDeferFunctionArguments< FuncPtr, Function >
 Defers a set of arguments for a function call later with its first argument. This is useful for developing fluent API operators. More...
 

Namespaces

namespace  Mcro
 
namespace  Mcro::FunctionTraits
 
namespace  Mcro::FunctionTraits::Detail
 

Concepts

concept  Mcro::FunctionTraits::CFunctorObject
 Concept constraining input T to a lambda function or a functor object.
 
concept  Mcro::FunctionTraits::CFunction_IsMember
 
concept  Mcro::FunctionTraits::CFunction_IsConst
 Shorthand for getting the constness of a member function.
 
concept  Mcro::FunctionTraits::CFunctionLike
 A concept accepting any function like entity (function pointer or functor object)
 
concept  Mcro::FunctionTraits::CFunctionPtr
 A concept accepting function pointer types.
 
concept  Mcro::FunctionTraits::CHasFunction
 
concept  Mcro::FunctionTraits::CTupleCompatibleWithFunction
 Is given tuple type compatible with the arguments of the given function?
 
concept  Mcro::FunctionTraits::CFunctionCompatible_ReturnDecay
 Concept matching the return of a type with compatible return types, disregarding CV-ref qualifiers.
 
concept  Mcro::FunctionTraits::CFunctionCompatible_Return
 Concept matching the return of a type with compatible return types, preserving CV-ref qualifiers.
 
concept  Mcro::FunctionTraits::CFunctionCompatible_ArgumentsDecay
 Concept matching function types with compatible set of arguments, disregarding CV-ref qualifiers.
 
concept  Mcro::FunctionTraits::CFunctionCompatible_Arguments
 Concept matching function types with compatible set of arguments, preserving CV-ref qualifiers.
 
concept  Mcro::FunctionTraits::CFunctionCompatibleDecay
 Concept constraining a function type to another one which arguments and return types are compatible, disregarding CV-ref qualifiers.
 
concept  Mcro::FunctionTraits::CFunctionCompatible
 Concept constraining a function type to another one which arguments and return types are compatible, preserving CV-ref qualifiers.
 
concept  Mcro::FunctionTraits::CFunctionReturnsVoid
 Concept matching function types returning void.
 
concept  Mcro::FunctionTraits::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 Mcro::FunctionTraits::TFunction_Arguments = typename TFunctionTraits<std::decay_t<T>>::Arguments
 Shorthand for getting a tuple representing the function arguments.
 
template<typename T >
using Mcro::FunctionTraits::TFunction_ArgumentsDecay = typename TFunctionTraits<std::decay_t<T>>::ArgumentsDecay
 Shorthand for getting a tuple representing the decayed function arguments.
 
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.
 
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.
 
template<typename T >
using Mcro::FunctionTraits::TFunction_Return = typename TFunctionTraits<std::decay_t<T>>::Return
 Shorthand for getting a function return type.
 
template<typename T >
using Mcro::FunctionTraits::TFunction_ReturnDecay = typename TFunctionTraits<std::decay_t<T>>::Return
 Shorthand for getting a function return type discarding qualifiers.
 
template<typename T >
using Mcro::FunctionTraits::TFunction_Signature = typename TFunctionTraits<std::decay_t<T>>::Signature
 Shorthand for getting a pur function signature.
 
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.
 
template<typename Return , typename Tuple , size_t... Indices>
using Mcro::FunctionTraits::Detail::TFunctionFromTupleIndices = Return(typename TTupleElement<Indices, Tuple>::Type...)
 
template<typename Return , typename Tuple >
using Mcro::FunctionTraits::TFunctionFromTuple = typename Detail::TFunctionFromTuple_Struct<Return, std::decay_t<Tuple>>::Type
 Compose a function type from a tuple of arguments and a return type.
 
template<typename Return , typename DstFunction >
using Mcro::FunctionTraits::TSetReturn = TFunctionFromTuple<Return, TFunction_Arguments<DstFunction>>
 Override the return type of an input function signature.
 
template<typename Return , typename DstFunction >
using Mcro::FunctionTraits::TSetReturnDecay = TFunctionFromTuple<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 Mcro::FunctionTraits::TCopyReturn = TSetReturn<TFunction_Return<SrcFunction>, DstFunction>
 Copy the return type from source function signature to the destination one.
 
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.
 

Functions

template<typename Function , CTuple Tuple, size_t... Sequence>
TFunction_Return< Function > Mcro::FunctionTraits::Detail::InvokeWithTuple_Impl (Function &&function, Tuple &&arguments, std::index_sequence< Sequence... > &&)
 
template<typename Object , typename Function , CTuple Tuple, size_t... Sequence>
TFunction_Return< Function > Mcro::FunctionTraits::Detail::InvokeWithTuple_Impl (Object *object, Function &&function, Tuple &&arguments, std::index_sequence< Sequence... > &&)
 
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.
 
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.
 

Variables

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

Detailed Description

Author
David Mórász
Date
2025

Definition in file FunctionTraits.h.