TTuple定义
template <typename... Types>
struct TTuple : UE4Tuple_Private::TTupleImpl<TMakeIntegerSequence<uint32, sizeof...(Types)>, Types...>
{
private:
typedef UE4Tuple_Private::TTupleImpl<TMakeIntegerSequence<uint32, sizeof...(Types)>, Types...> Super;
public:
template <
typename... ArgTypes,
typename = typename TEnableIf<
TAndValue<
sizeof...(ArgTypes) == sizeof...(Types) && sizeof...(ArgTypes) != 0,
TOrValue<
sizeof...(ArgTypes) != 1,
TNot<UE4Tuple_Private::TDecayedFrontOfParameterPackIsSameType<TTuple, ArgTypes...>>
>
>::Value
>::Type
>
explicit TTuple(ArgTypes&&... Args)
: Super(Forward<ArgTypes>(Args)...)
{
}
};
TTupleImpl类实现了ApplyAfter和ApplyBefore, After指的是转发调用时函数参数在前,TTuple存储值在后,Before则相反.
template <uint32... Indices, typename... Types>
struct TTupleImpl<TIntegerSequence<uint32, Indices...>, Types...> : TTupleStorage<TIntegerSequence<uint32, Indices...>, Types...>
{
template <typename FuncType, typename... ArgTypes>
#if PLATFORM_COMPILER_HAS_DECLTYPE_AUTO
decltype(auto) ApplyAfter(FuncType&& Func, ArgTypes&&... Args) const
#else
auto ApplyAfter(FuncType&& Func, ArgTypes&&... Args) const -> decltype(Func(Forward<ArgTypes>(Args)..., this->Get<Indices>()...))
#endif
{
return Func(Forward<ArgTypes>(Args)..., this->template Get<Indices>()...);
}
template <typename FuncType, typename... ArgTypes>
#if PLATFORM_COMPILER_HAS_DECLTYPE_AUTO
decl