14#include "CoreMinimal.h"
26 template <
size_t I,
typename First = void,
typename... Rest>
32 template <
typename First,
typename... Rest>
39 template <
size_t I,
typename... T>
42 static_assert(I <=
sizeof...(T),
"Indexing parameter pack out of its bounds.");
57 template<
size_t I,
typename... Rest>
65 template<
size_t I,
typename... Rest>
73 template<
size_t I,
typename... Rest>
81 template<
size_t I,
typename... Rest>
84 template <
size_t I,
typename T>
87 static_assert(
sizeof(T) == 0,
"TTupleSafeElement_Struct is instantiated with non TTuple.");
90 template <
size_t I,
typename... T>
104 template <
typename... T>
107 static constexpr size_t Count =
sizeof...(T);
116 template <
typename T>
119 template <
typename... T>
123 template <
typename T>
126 template <CIsTypeList T,
size_t I>
129 template <CIsTypeList T,
size_t I>
140 template <
template <
typename...>
typename Template>
143 template <
typename T>
144 static constexpr bool Match =
false;
146 template <
typename... Params>
147 static constexpr bool Match<Template<Params...>> =
true;
149 template <
typename T>
152 template <
typename... Params>
155 template <
typename T>
161 template <
typename... Params>
164 using Type = TTuple<Params...>;
167 template <
typename T>
173 template <
typename... Params>
176 using Type = TTuple<std::decay_t<Params>...>;
179 template <
typename Instance,
int I>
182 template <
typename Instance,
int I>
194 template <
template <
typename...>
typename Template,
typename Instance>
205 template <
template <
typename...>
typename Template,
typename Instance>
216 template <
template <
typename...>
typename Template,
typename Instance,
int I>
227 template <
template <
typename...>
typename Template,
typename Instance,
int I>
238 template <
typename Instance,
template <
typename...>
typename Template>
239 concept CIsTemplate = TTemplate<Template>::template Match<std::decay_t<Instance>>;
250 template <
template <
typename...>
typename Template,
typename Instance>
254 template <CConstType T>
258 template <CMutableType T>
259 constexpr auto&&
AsConst(T&& input) {
return FWD(
const_cast<const T
>(input)); }
262 template <CMutableType T>
266 template <CConstType T>
267 constexpr auto&&
AsMutable(T&& input) {
return FWD(
const_cast<T
>(input)); }
270 template <
typename T>
274 template <
typename T>
275 constexpr auto AsConstPtr(T* input) {
return const_cast<const T*
>(input); }
278 template <
typename T>
282 template <
typename T>
283 constexpr auto AsMutablePtr(
const T* input) {
return const_cast<T*
>(input); }
This header exists because STL headers in Android doesn't define STL concepts (other than same_as whi...
#define FWD(...)
Shorten forwarding expression with this macro so one may not need to specify explicit type.
Check if given type is an instantiation of a given template (which only accepts type parameters)
Concept constraining a given type to TTypes
This namespace provides templating utilities and introspection into template instantiations.
typename TTypeAtPack_Struct< I, Rest... >::Type TTypeAtPack
Get a specific item from a parameter pack at given index. It is an unspecified compile error to index...
typename TTemplate< Template >::template Parameters< Instance >::Type TTemplate_Params
Get template type parameters as a tuple.
std::decay_t< typename TTypeAtPack_Struct< I, Rest... >::Type > TTypeAtPackDecay
Get a specific item from a parameter pack at given index disregarding CV-ref qualifiers....
T::template Get< I > TTypes_Get
std::decay_t< typename TTypeAtPack_Struct< sizeof...(Rest) - I, Rest... >::Type > TLastTypeAtPackDecay
Get a specific item from the end of a parameter pack at given index (0 == last) disregarding CV-ref q...
typename TTypeAtPack_Struct< sizeof...(Rest) - I, Rest... >::Type TLastTypeAtPack
Get a specific item from the end of a parameter pack at given index (0 == last). It is an unspecified...
constexpr auto AsMutablePtr(T *input)
Tired of typing const_cast<FMyLongUnwieldyTypeName*>(...)? use this instead.
constexpr size_t TTemplate_ParamCount
Get the number of template type parameters from a specified templated instance (which only has type p...
constexpr auto && AsMutable(T &&input)
Tired of typing const_cast<FMyLongUnwieldyTypeName>(...)? use this instead.
T::template GetDecay< I > TTypes_GetDecay
typename TTemplate< Template >::template Param< Instance, I > TTemplate_Param
Get a type parameter at a specified position of a templated instance.
typename TTemplate< Template >::template ParametersDecay< Instance >::Type TTemplate_ParamsDecay
Get decayed template type parameters as a tuple.
constexpr auto AsConstPtr(const T *input)
Tired of typing const_cast<FMyLongUnwieldyTypeName*>(...)? use this instead.
constexpr auto && AsConst(T &&input)
Tired of typing const_cast<FMyLongUnwieldyTypeName>(...)? use this instead.
typename TTemplate< Template >::template ParamDecay< Instance, I > TTemplate_ParamDecay
Get a decayed type parameter at a specified position of a templated instance.
typename TTypeAtPack_Impl< I - 1, Rest... >::Type Type
static constexpr bool Value
TTuple< std::decay_t< Params >... > Type
Base struct containing traits of specified template (which only accepts type parameters)
static constexpr size_t ParameterCount
typename TTupleSafeElement_Struct< I, typename ParametersDecay< Instance >::Type >::Type ParamDecay
typename TTupleSafeElement_Struct< I, typename Parameters< Instance >::Type >::Type Param
static constexpr bool Match
TTypeAtPack< I, T... > Type
typename Detail::TTypeAtPack_Impl< I, T... >::Type Type
This template is used to store pack of types in other templates, or to allow parameter pack inference...
TTypeAtPack< I, T... > Get
TTypeAtPackDecay< I, T... > GetDecay
static constexpr size_t Count