UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
Tuple.h File Reference
#include "CoreTypes.h"
#include "Concepts/NotCVRefTo.h"
#include "Templates/UnrealTemplate.h"
#include "Delegates/IntegerSequence.h"
#include "Templates/Invoke.h"
#include "Serialization/StructuredArchive.h"
#include "Serialization/MemoryLayout.h"
#include "Templates/Requires.h"
#include "Templates/TypeHash.h"
#include <tuple>
#include <type_traits>

Go to the source code of this file.

Classes

struct  UE::Core::Private::Tuple::TTupleBaseElement< T, Index, TupleSize >
 
struct  UE::Core::Private::Tuple::TTupleBaseElement< T, 0, 2 >
 
struct  UE::Core::Private::Tuple::TTupleElementGetterByIndex< Index, TupleSize >
 
struct  UE::Core::Private::Tuple::TTupleElementGetterByIndex< 0, 2 >
 
struct  UE::Core::Private::Tuple::TTupleElementGetterByType< Type, TupleSize >
 
struct  UE::Core::Private::Tuple::FEqualityHelper< ArgCount, ArgToCompare >
 
struct  UE::Core::Private::Tuple::FEqualityHelper< ArgCount, ArgCount >
 
struct  UE::Core::Private::Tuple::TLessThanHelper< NumArgs, ArgToCompare, Last >
 
struct  UE::Core::Private::Tuple::TLessThanHelper< NumArgs, ArgToCompare, true >
 
struct  UE::Core::Private::Tuple::TLessThanHelper< NumArgs, NumArgs, false >
 
struct  UE::Core::Private::Tuple::TTupleBase< TIntegerSequence< uint32, Indices... >, Types... >
 
struct  UE::Core::Private::Tuple::TTransformTuple_Impl< TIntegerSequence< uint32, Indices... > >
 
struct  UE::Core::Private::Tuple::TVisitTupleElements_Impl< TIntegerSequence< uint32, Indices... > >
 
struct  UE::Core::Private::Tuple::TCVTupleArity< const volatile TTuple< Types... > >
 
struct  UE::Core::Private::Tuple::TCVTupleIndex< Type, TupleType >
 
struct  UE::Core::Private::Tuple::TCVTupleIndex< Type, const volatile TTuple< TupleTypes... > >
 
struct  UE::Core::Private::Tuple::TCVTupleElement< Index, TupleType >
 
struct  UE::Core::Private::Tuple::TCVTupleElement< Index, const volatile TTuple< TupleTypes... > >
 
struct  UE::Core::Private::Tuple::TGetTupleHashHelper< ArgToCombine, ArgCount >
 
struct  UE::Core::Private::Tuple::TGetTupleHashHelper< ArgIndex, ArgIndex >
 
struct  TTuple< Types >
 
struct  TTupleArity< TupleType >
 
struct  TIsTuple< T >
 
struct  std::tuple_size< TTuple< ArgTypes... > >
 
struct  std::tuple_element< N, TTuple< ArgTypes... > >
 

Namespaces

namespace  UE
 
namespace  UE::Core
 
namespace  UE::Core::Private
 implementation
 
namespace  UE::Core::Private::Tuple
 
namespace  Freeze
 

Macros

#define UE_TUPLE_STATIC_ANALYSIS_WORKAROUND   0
 
#define UE_TUPLE_REFERENCE_WORKAROUND   0
 

Typedefs

template<typename KeyType , typename ValueType >
using TPair = TTuple< KeyType, ValueType >
 
template<typename Type , typename TupleType >
using TTupleIndex = UE::Core::Private::Tuple::TCVTupleIndex< Type, const volatile TupleType >
 
template<uint32 Index, typename TupleType >
using TTupleElement = UE::Core::Private::Tuple::TCVTupleElement< Index, const volatile TupleType >
 

Enumerations

enum  UE::Core::Private::Tuple::EForwardingConstructor { UE::Core::Private::Tuple::ForwardingConstructor }
 
enum  UE::Core::Private::Tuple::EOtherTupleConstructor { UE::Core::Private::Tuple::OtherTupleConstructor }
 

Functions

template<typename... Types>
constexpr TTuple< std::decay_t< Types >... > MakeTuple (Types &&... Args)
 
template<typename... ElementTypes, typename... Types>
UE_FORCEINLINE_HINT constexpr TTuple< ElementTypes... > UE::Core::Private::Tuple::MakeTupleImpl (Types &&... Args)
 
template<typename... Types>
UE_FORCEINLINE_HINT uint32 GetTypeHash (const TTuple< Types... > &Tuple)
 
UE_FORCEINLINE_HINT uint32 GetTypeHash (const TTuple<> &Tuple)
 
template<typename KeyType , typename ValueType >
void Freeze::IntrinsicWriteMemoryImage (FMemoryImageWriter &Writer, const TTuple< KeyType, ValueType > &Object, const FTypeLayoutDesc &)
 
template<typename KeyType , typename ValueType >
uint32 Freeze::IntrinsicUnfrozenCopy (const FMemoryUnfreezeContent &Context, const TTuple< KeyType, ValueType > &Object, void *OutDst)
 
template<typename KeyType , typename ValueType >
uint32 Freeze::IntrinsicAppendHash (const TTuple< KeyType, ValueType > *DummyObject, const FTypeLayoutDesc &TypeDesc, const FPlatformTypeLayoutParameters &LayoutParams, FSHA1 &Hasher)
 
template<typename KeyType , typename ValueType >
uint32 Freeze::IntrinsicGetTargetAlignment (const TTuple< KeyType, ValueType > *DummyObject, const FTypeLayoutDesc &TypeDesc, const FPlatformTypeLayoutParameters &LayoutParams)
 
 DECLARE_TEMPLATE_INTRINSIC_TYPE_LAYOUT ((template< typename KeyType, typename ValueType >),(TTuple< KeyType, ValueType >))
 
template<typename... Types>
UE_FORCEINLINE_HINT constexpr TTuple< std::decay_t< Types >... > MakeTuple (Types &&... Args)
 
template<typename... Types>
UE_FORCEINLINE_HINT TTuple< Types &&... > ForwardAsTuple (Types &&... Args)
 
template<typename FuncType , typename... Types>
UE_FORCEINLINE_HINT decltype(autoTransformTuple (TTuple< Types... > &&Tuple, FuncType Func)
 
template<typename FuncType , typename... Types>
UE_FORCEINLINE_HINT decltype(autoTransformTuple (const TTuple< Types... > &Tuple, FuncType Func)
 
template<typename FuncType , typename FirstTupleType , typename... TupleTypes>
UE_FORCEINLINE_HINT void VisitTupleElements (FuncType &&Func, FirstTupleType &&FirstTuple, TupleTypes &&... Tuples)
 
template<typename... Types>
UE_FORCEINLINE_HINT TTuple< Types &... > Tie (Types &... Args)
 
template<int N, typename TupleType >
requires (TIsTuple_V<std::decay_t<TupleType>>)
decltype(autoget (TupleType &&val)
 
template<typename... Types>
FArchiveoperator<< (FArchive &Ar, TTuple< Types... > &Tuple)
 
template<typename... Types>
UE_FORCEINLINE_HINT void operator<< (FStructuredArchive::FSlot Slot, TTuple< Types... > &Tuple)
 

Variables

template<typename T , typename... Types>
constexpr uint32 UE::Core::Private::Tuple::TTypeCountInParameterPack_V = 0
 
template<typename T , typename U , typename... Types>
constexpr uint32 UE::Core::Private::Tuple::TTypeCountInParameterPack_V< T, U, Types... > = TTypeCountInParameterPack_V<T, Types...> + (std::is_same_v<T, U> ? 1 : 0)
 
template<typename T >
constexpr bool TIsTuple_V = false
 
template<typename... Types>
constexpr bool TIsTuple_V< TTuple< Types... > > = true
 
template<typename... Types>
constexpr bool TIsTuple_V< const TTuple< Types... > > = true
 
template<typename... Types>
constexpr bool TIsTuple_V< volatile TTuple< Types... > > = true
 
template<typename... Types>
constexpr bool TIsTuple_V< const volatile TTuple< Types... > > = true
 

Macro Definition Documentation

◆ UE_TUPLE_REFERENCE_WORKAROUND

#define UE_TUPLE_REFERENCE_WORKAROUND   0

◆ UE_TUPLE_STATIC_ANALYSIS_WORKAROUND

#define UE_TUPLE_STATIC_ANALYSIS_WORKAROUND   0

Typedef Documentation

◆ TPair

template<typename KeyType , typename ValueType >
using TPair = TTuple<KeyType, ValueType>

◆ TTupleElement

Traits class which gets the element type of a TTuple with the given index. If the index is out of range, a compile error is generated.

Given Index = 1, and Tuple = TTuple<int, float, char>, TTupleElement<Index, Tuple>::Type will be float.

◆ TTupleIndex

Traits class which gets the tuple index of a given type from a given TTuple. If the type doesn't appear, or appears more than once, a compile error is generated.

Given Type = char, and Tuple = TTuple<int, float, char>, TTupleIndex<Type, Tuple>::Value will be 2.

Function Documentation

◆ DECLARE_TEMPLATE_INTRINSIC_TYPE_LAYOUT()

DECLARE_TEMPLATE_INTRINSIC_TYPE_LAYOUT ( (template< typename KeyType, typename ValueType >)  ,
(TTuple< KeyType, ValueType >)   
)

◆ ForwardAsTuple()

template<typename... Types>
UE_FORCEINLINE_HINT TTuple< Types &&... > ForwardAsTuple ( Types &&...  Args)

Makes a TTuple from some arguments. Unlike MakeTuple, the TTuple element types are references and retain the same value category of the arguments, like the Forward function.

Parameters
ArgsThe arguments used to construct the tuple.
Returns
A tuple containing forwarded references to the arguments.

Example:

template <typename... Ts> void Foo(const TTuple<Ts...>&);

void Func(const int32 A, FString&& B) { // Calls Foo<const int32&, const TCHAR(&)[6], FString&&>(...); Foo(ForwardAsTuple(A, TEXT("Hello"), MoveTemp(B))); }

◆ get()

template<int N, typename TupleType >
requires (TIsTuple_V<std::decay_t<TupleType>>)
decltype(auto) get ( TupleType &&  val)

◆ GetTypeHash() [1/2]

template<typename... Types>
UE_FORCEINLINE_HINT uint32 GetTypeHash ( const TTuple< Types... > &  Tuple)

◆ GetTypeHash() [2/2]

UE_FORCEINLINE_HINT uint32 GetTypeHash ( const TTuple<> &  Tuple)

◆ MakeTuple() [1/2]

template<typename... Types>
constexpr TTuple< std::decay_t< Types >... > MakeTuple ( Types &&...  Args)
constexpr

Makes a TTuple from some arguments. The type of the TTuple elements are the decayed versions of the arguments.

Parameters
ArgsThe arguments used to construct the tuple.
Returns
A tuple containing a copy of the arguments.

Example:

void Func(const int32 A, FString&& B) { // Equivalent to: // TTuple<int32, const TCHAR*, FString> MyTuple(A, TEXT("Hello"), MoveTemp(B)); auto MyTuple = MakeTuple(A, TEXT("Hello"), MoveTemp(B)); }

◆ MakeTuple() [2/2]

template<typename... Types>
UE_FORCEINLINE_HINT constexpr TTuple< std::decay_t< Types >... > MakeTuple ( Types &&...  Args)
constexpr

Makes a TTuple from some arguments. The type of the TTuple elements are the decayed versions of the arguments.

Parameters
ArgsThe arguments used to construct the tuple.
Returns
A tuple containing a copy of the arguments.

Example:

void Func(const int32 A, FString&& B) { // Equivalent to: // TTuple<int32, const TCHAR*, FString> MyTuple(A, TEXT("Hello"), MoveTemp(B)); auto MyTuple = MakeTuple(A, TEXT("Hello"), MoveTemp(B)); }

◆ operator<<() [1/2]

template<typename... Types>
FArchive & operator<< ( FArchive Ar,
TTuple< Types... > &  Tuple 
)
inline

◆ operator<<() [2/2]

template<typename... Types>
UE_FORCEINLINE_HINT void operator<< ( FStructuredArchive::FSlot  Slot,
TTuple< Types... > &  Tuple 
)

◆ Tie()

template<typename... Types>
UE_FORCEINLINE_HINT TTuple< Types &... > Tie ( Types &...  Args)

Tie function for structured unpacking of tuples into individual variables.

Example:

TTuple<FString, float, TArray<int32>> SomeFunction();

FString Ret1; float Ret2; TArray<int32> Ret3;

Tie(Ret1, Ret2, Ret3) = SomeFunction();

// Now Ret1, Ret2 and Ret3 contain the unpacked return values.

◆ TransformTuple() [1/2]

template<typename FuncType , typename... Types>
UE_FORCEINLINE_HINT decltype(auto) TransformTuple ( const TTuple< Types... > &  Tuple,
FuncType  Func 
)

◆ TransformTuple() [2/2]

template<typename FuncType , typename... Types>
UE_FORCEINLINE_HINT decltype(auto) TransformTuple ( TTuple< Types... > &&  Tuple,
FuncType  Func 
)

Creates a new TTuple by applying a functor to each of the elements.

Parameters
TupleThe tuple to apply the functor to.
FuncThe functor to apply.
Returns
A new tuple of the transformed elements.

Example:

float Overloaded(int32 Arg); char Overloaded(const TCHAR* Arg); const TCHAR* Overloaded(const FString& Arg);

void Func(const TTuple<int32, const TCHAR*, FString>& MyTuple) { // Equivalent to: // TTuple<float, char, const TCHAR*> TransformedTuple(Overloaded(MyTuple.Get<0>()), Overloaded(MyTuple.Get<1>()), Overloaded(MyTuple.Get<2>()))); auto TransformedTuple = TransformTuple(MyTuple, [](const auto& Arg) { return Overloaded(Arg); }); }

◆ VisitTupleElements()

template<typename FuncType , typename FirstTupleType , typename... TupleTypes>
UE_FORCEINLINE_HINT void VisitTupleElements ( FuncType &&  Func,
FirstTupleType &&  FirstTuple,
TupleTypes &&...  Tuples 
)

Visits each element in the specified tuples in parallel and applies them as arguments to the functor. All specified tuples must have the same number of elements.

Parameters
FuncThe functor to apply.
TuplesThe tuples whose elements are to be applied to the functor.

Example:

void Func(const TTuple<int32, const TCHAR*, FString>& Tuple1, const TTuple<bool, float, FName>& Tuple2) { // Equivalent to: // Functor(Tuple1.Get<0>(), Tuple2.Get<0>()); // Functor(Tuple1.Get<1>(), Tuple2.Get<1>()); // Functor(Tuple1.Get<2>(), Tuple2.Get<2>()); VisitTupleElements(Functor, Tuple1, Tuple2); }

Variable Documentation

◆ TIsTuple_V

template<typename T >
constexpr bool TIsTuple_V = false
constexpr

◆ TIsTuple_V< const TTuple< Types... > >

template<typename... Types>
constexpr bool TIsTuple_V< const TTuple< Types... > > = true
constexpr

◆ TIsTuple_V< const volatile TTuple< Types... > >

template<typename... Types>
constexpr bool TIsTuple_V< const volatile TTuple< Types... > > = true
constexpr

◆ TIsTuple_V< TTuple< Types... > >

template<typename... Types>
constexpr bool TIsTuple_V< TTuple< Types... > > = true
constexpr

◆ TIsTuple_V< volatile TTuple< Types... > >

template<typename... Types>
constexpr bool TIsTuple_V< volatile TTuple< Types... > > = true
constexpr