MCRO
C++23 utilities for Unreal Engine.
Loading...
Searching...
No Matches
Templates.h
Go to the documentation of this file.
1/** @noop License Comment
2 * @file
3 * @copyright
4 * This Source Code is subject to the terms of the Mozilla Public License, v2.0.
5 * If a copy of the MPL was not distributed with this file You can obtain one at
6 * https://mozilla.org/MPL/2.0/
7 *
8 * @author David Mórász
9 * @date 2025
10 */
11
12#pragma once
13
14#include "CoreMinimal.h"
15#include "Mcro/Macros.h"
16#include "Mcro/Concepts.h"
17
18/**
19 * @brief This namespace provides templating utilities and introspection into template instantiations.
20 */
22{
23 using namespace Mcro::Concepts;
24
25 namespace Detail
26 {
27 template <size_t I, typename First = void, typename... Rest>
29 {
30 using Type = typename TTypeAtPack_Impl<I - 1, Rest...>::Type;
31 };
32
33 template <typename First, typename... Rest>
34 struct TTypeAtPack_Impl<0, First, Rest...>
35 {
36 using Type = First;
37 };
38 }
39
40 template <size_t I, typename... T>
42 {
43 static_assert(I <= sizeof...(T), "Indexing parameter pack out of its bounds.");
44 using Type = typename Detail::TTypeAtPack_Impl<I, T...>::Type;
45 };
46
47 template <size_t I>
49 {
50 using Type = void;
51 };
52
53 /**
54 * @brief
55 * Get a specific item from a parameter pack at given index. It is an unspecified compile error to index an empty
56 * parameter pack.
57 */
58 template<size_t I, typename... Rest>
59 using TTypeAtPack = typename TTypeAtPack_Struct<I, Rest...>::Type;
60
61 /**
62 * @brief
63 * Get a specific item from the end of a parameter pack at given index (0 == last). It is an unspecified compile
64 * error to index an empty parameter pack.
65 */
66 template<size_t I, typename... Rest>
67 using TLastTypeAtPack = typename TTypeAtPack_Struct<sizeof...(Rest) - I - 1, Rest...>::Type;
68
69 /**
70 * @brief
71 * Get a specific item from a parameter pack at given index disregarding CV-ref qualifiers. It is an unspecified
72 * compile error to index an empty parameter pack.
73 */
74 template<size_t I, typename... Rest>
75 using TTypeAtPackDecay = std::decay_t<typename TTypeAtPack_Struct<I, Rest...>::Type>;
76
77 /**
78 * @brief
79 * Get a specific item from the end of a parameter pack at given index (0 == last) disregarding CV-ref qualifiers.
80 * It is an unspecified compile error to index an empty parameter pack.
81 */
82 template<size_t I, typename... Rest>
83 using TLastTypeAtPackDecay = std::decay_t<typename TTypeAtPack_Struct<sizeof...(Rest) - I - 1, Rest...>::Type>;
84
85 template <size_t I, typename T>
87 {
88 static_assert(sizeof(T) == 0, "TTupleSafeElement_Struct is instantiated with non TTuple.");
89 };
90
91 template <size_t I, typename... T>
92 struct TTupleSafeElement_Struct<I, TTuple<T...>>
93 {
94 using Type = TTypeAtPack<I, T...>;
95 };
96
97 /**
98 * @brief
99 * This template is used to store pack of types in other templates, or to allow parameter pack inference for
100 * functions. This template may be referred to as 'type-list' in other parts of the documentation.
101 *
102 * This may be much safer to use than tuples as they may try to use deleted features of listed types (especially
103 * Unreal tuples). `TTypes` will never attempt to use its arguments (not even in `decltype` or `declval` contexts)
104 */
105 template <typename... T>
106 struct TTypes
107 {
108 static constexpr size_t Count = sizeof...(T);
109
110 template <size_t I>
111 using Get = TTypeAtPack<I, T...>;
112
113 template <size_t I>
114 using GetDecay = TTypeAtPackDecay<I, T...>;
115 };
116
117 template <typename T>
118 struct TIsTypeList_Struct { static constexpr bool Value = false; };
119
120 template <typename... T>
121 struct TIsTypeList_Struct<TTypes<T...>> { static constexpr bool Value = true; };
122
123 /** @brief Concept constraining a given type to `TTypes` */
124 template <typename T>
126
127 template <CTypeList T, size_t I>
128 using TTypes_Get = T::template Get<I>;
129
130 template <CTypeList T, size_t I>
131 using TTypes_GetDecay = T::template GetDecay<I>;
132
133 /**
134 * Compose a type-list out of the elements of the input type-list based on the input index parameter pack
135 */
136 template <CTypeList T, size_t... Indices>
138
139 template <size_t Count, CTypeList T>
140 requires (T::Count >= Count)
142 {
143 /**
144 * Since this is only meant to be used in decltype, no implementation is needed
145 */
146 template <size_t... Indices>
147 static consteval TComposeTypeListFrom<T, (Indices + Count)...> Compose(std::index_sequence<Indices...>&&);
148
149 using Type = decltype(
150 Compose(std::make_index_sequence<T::Count - Count>{})
151 );
152 };
153
154 /**
155 * Skip the first `Count` elements of the input type-list
156 */
157 template <size_t Count, CTypeList T>
159
160 template <size_t Count, CTypeList T>
161 requires (T::Count >= Count)
163 {
164 /**
165 * Since this is only meant to be used in decltype, no implementation is needed
166 */
167 template <size_t... Indices>
168 static consteval TComposeTypeListFrom<T, Indices...> Compose(std::index_sequence<Indices...>&&);
169
170 using Type = decltype(
171 Compose(std::make_index_sequence<T::Count - Count>{})
172 );
173 };
174
175 /**
176 * Disregard the last `Count` elements of the input type-list
177 */
178 template <size_t Count, typename T>
180
181 template <size_t Count, typename T>
182 requires (T::Count >= Count)
184 {
185 /**
186 * Since this is only meant to be used in decltype, no implementation is needed
187 */
188 template <size_t... Indices>
189 static consteval TComposeTypeListFrom<T, Indices...> Compose(std::index_sequence<Indices...>&&);
190
191 using Type = decltype(
192 Compose(std::make_index_sequence<Count>{})
193 );
194 };
195
196 /**
197 * Take only the first `Count` elements of the input type-list
198 */
199 template <size_t Count, typename T>
201
202 namespace Detail
203 {
204 template <CTypeList TypeList, auto Test, size_t... Indices>
205 consteval bool AllOfTypeList(bool onEmpty, std::index_sequence<Indices...>&&)
206 {
207 if constexpr (sizeof...(Indices) == 0)
208 return onEmpty;
209 else
210 return (... && Test(TTypes<TTypes_Get<TypeList, Indices>>{}));
211 }
212
213 template <CTypeList TypeList, auto Test, size_t... Indices>
214 consteval bool AllOfTypeListDecay(bool onEmpty, std::index_sequence<Indices...>&&)
215 {
216 if constexpr (sizeof...(Indices) == 0)
217 return onEmpty;
218 else
219 return (... && Test(TTypes<TTypes_GetDecay<TypeList, Indices>>{}));
220 }
221
222 template <CTypeList TypeList, auto Test, size_t... Indices>
223 consteval bool AnyOfTypeList(bool onEmpty, std::index_sequence<Indices...>&&)
224 {
225 if constexpr (sizeof...(Indices) == 0)
226 return onEmpty;
227 else
228 return (... || Test(TTypes<TTypes_Get<TypeList, Indices>>{}));
229 }
230
231 template <CTypeList TypeList, auto Test, size_t... Indices>
232 consteval bool AnyOfTypeListDecay(bool onEmpty, std::index_sequence<Indices...>&&)
233 {
234 if constexpr (sizeof...(Indices) == 0)
235 return onEmpty;
236 else
237 return (... || Test(TTypes<TTypes_GetDecay<TypeList, Indices>>{}));
238 }
239
240 template <CTypeList From, CTypeList To, size_t... Indices>
241 consteval bool IsTypeListConvertibleTo(bool onEmpty, std::index_sequence<Indices...>&&)
242 {
243 if constexpr (sizeof...(Indices) == 0)
244 return onEmpty;
245 else
246 return (... && std::convertible_to<TTypes_Get<From, Indices>, TTypes_Get<To, Indices>>);
247 }
248
249 template <CTypeList From, CTypeList To, size_t... Indices>
250 consteval bool IsTypeListConvertibleToDecay(bool onEmpty, std::index_sequence<Indices...>&&)
251 {
252 if constexpr (sizeof...(Indices) == 0)
253 return onEmpty;
254 else
255 return (... && CConvertibleToDecayed<TTypes_Get<From, Indices>, TTypes_Get<To, Indices>>);
256 }
257 }
258
259#define MCRO_TYPE_LIST_PREDICATE(Function, TypeList, OnEmpty, ...) \
260 Function< \
261 BOOST_PP_REMOVE_PARENS(TypeList), \
262 [] <typename T> (TTypes<T>&&) { return __VA_ARGS__; } \
263 >(OnEmpty, std::make_index_sequence<BOOST_PP_REMOVE_PARENS(TypeList)::Count>())
264
265/**
266 * @brief
267 * Apply an arbitrary predicate to all types in a type-list, All must pass.
268 *
269 * @param typeList Input typelist
270 * @param onEmpty Default value if type-list is empty
271 */
272#define ALL_OF_TYPE_LIST(typeList, onEmpty, ...) MCRO_TYPE_LIST_PREDICATE(Detail::AllOfTypeList, typeList, onEmpty, __VA_ARGS__)
273
274/**
275 * @brief
276 * Apply a concept to all types in a type-list, All must pass. If a concept needs extra template arguments you can
277 * provide them as variadic macro arguments.
278 *
279 * @param TypeList Input typelist
280 * @param onEmpty Default value if type-list is empty
281 * @param conceptIn The given concept to check for all items in the typeList
282 */
283#define C_ALL_OF_TYPE_LIST(typeList, onEmpty, conceptIn, ...) ALL_OF_TYPE_LIST(typeList, onEmpty, conceptIn<T __VA_OPT__(,) __VA_ARGS__>)
284
285/**
286 * @brief
287 * Apply an arbitrary predicate to all types in a type-list, Any of them can pass.
288 *
289 * @param typeList Input typelist
290 * @param onEmpty Default value if type-list is empty
291 */
292#define ANY_OF_TYPE_LIST(typeList, onEmpty, ...) MCRO_TYPE_LIST_PREDICATE(Detail::AnyOfTypeList, typeList, onEmpty, __VA_ARGS__)
293
294/**
295 * @brief
296 * Apply a concept to all types in a type-list, Any of them can pass. If a concept needs extra template arguments you can
297 * provide them as variadic macro arguments.
298 *
299 * @param TypeList Input typelist
300 * @param onEmpty Default value if type-list is empty
301 * @param conceptIn The given concept to check for all items in the typeList
302 */
303#define C_ANY_OF_TYPE_LIST(typeList, onEmpty, conceptIn, ...) ANY_OF_TYPE_LIST(typeList, onEmpty, conceptIn<T __VA_OPT__(,) __VA_ARGS__>)
304
305/**
306 * @brief
307 * Apply an arbitrary predicate to all types in input type parameter pack, All must pass.
308 *
309 * @param typeList input type parameter pack without ...
310 * @param onEmpty Default value if type parameter pack is empty
311 */
312#define ALL_OF_TYPE_PACK(TypePack, onEmpty, ...) ALL_OF_TYPE_LIST(TTypes<TypePack...>, onEmpty, __VA_ARGS__)
313
314/**
315 * @brief
316 * Apply a concept to all types in input type parameter pack, All must pass. If a concept needs extra template arguments
317 * you can provide them as variadic macro arguments.
318 *
319 * @param typeList input type parameter pack without ...
320 * @param onEmpty Default value if type parameter pack is empty
321 * @param conceptIn The given concept to check for all items in the type parameter pack
322 */
323#define C_ALL_OF_TYPE_PACK(TypePack, onEmpty, conceptIn, ...) C_ALL_OF_TYPE_LIST(TTypes<TypePack...>, onEmpty, conceptIn, __VA_ARGS__)
324
325/**
326 * @brief
327 * Apply an arbitrary predicate to all types in input type parameter pack, Any of them can pass.
328 *
329 * @param typeList input type parameter pack without ...
330 * @param onEmpty Default value if type parameter pack is empty
331 */
332#define ANY_OF_TYPE_PACK(TypePack, onEmpty, ...) ANY_OF_TYPE_LIST(TTypes<TypePack...>, onEmpty, __VA_ARGS__)
333
334/**
335 * @brief
336 * Apply a concept to all types in input type parameter pack, Any of them can pass. If a concept needs extra template
337 * arguments you can provide them as variadic macro arguments.
338 *
339 * @param typeList input type parameter pack without ...
340 * @param onEmpty Default value if type parameter pack is empty
341 * @param conceptIn The given concept to check for all items in the type parameter pack
342 */
343#define C_ANY_OF_TYPE_PACK(TypePack, onEmpty, conceptIn, ...) C_ANY_OF_TYPE_LIST(TTypes<TypePack...>, onEmpty, conceptIn, __VA_ARGS__)
344
345 /**
346 * @brief
347 * Is given type-list contains all types convertible to the types of another type-list. The number and order of types
348 * are significant.
349 */
350 template <typename From, typename To, bool OnEmpty = true>
354 && From::Count == To::Count
356 OnEmpty,
357 std::make_index_sequence<From::Count>()
358 )
359 ;
360
361 /**
362 * @brief
363 * Is given type-list contains all types convertible to the types of another type-list. The number and order of types
364 * are significant. Qualifiers are not taken into account.
365 */
366 template <typename From, typename To, bool OnEmpty = true>
370 && From::Count == To::Count
372 OnEmpty,
373 std::make_index_sequence<From::Count>()
374 )
375;
376
377 /**
378 * @brief Base struct for matching templates disregarding their arguments
379 *
380 * @warning
381 * Until this proposal https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1985r0.pdf or equivalent is
382 * considered seriously, template traits only work with templates which only have type-parameters. Non-type
383 * parameters even when a default is specified for them will result in compile error.
384 */
385 template <template <typename...> typename Template>
387 {
388 template <typename T>
389 static constexpr bool Match = false;
390
391 template <typename... Params>
392 static constexpr bool Match<Template<Params...>> = true;
393 };
394
395 template <typename>
397 {
398 static constexpr bool IsTemplate = false;
399 };
400
401 /**
402 * @brief Base struct containing traits of specified template instance (which only accepts type parameters)
403 *
404 * @warning
405 * Until this proposal https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1985r0.pdf or equivalent is
406 * considered seriously, template traits only work with templates which only have type-parameters. Non-type
407 * parameters even when a default is specified for them will result in compile error.
408 */
409 template <template <typename...> typename Template, typename... Params>
410 struct TTemplate_Struct<Template<Params...>>
411 {
412 static constexpr bool IsTemplate = true;
413
414 static constexpr size_t ParameterCount = sizeof...(Params);
415 using Parameters = TTypes<Params...>;
417
418 template <size_t I>
419 using Param = TTypeAtPack<I, Params...>;
420
421 template <size_t I>
423 };
424
425 /**
426 * @brief Checks if input is a template which only has type parameters
427 *
428 * @warning
429 * Until this proposal https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1985r0.pdf or equivalent is
430 * considered seriously, template traits only work with templates which only have type-parameters. Non-type
431 * parameters even when a default is specified for them will result in compile error.
432 */
433 template <typename T>
435
436 /**
437 * @brief Get template type parameters as a tuple
438 *
439 * @warning
440 * Until this proposal https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1985r0.pdf or equivalent is
441 * considered seriously, template traits only work with templates which only have type-parameters. Non-type
442 * parameters even when a default is specified for them will result in compile error.
443 */
444 template <CTypeOnlyTemplate Instance>
446
447 /**
448 * @brief Get decayed template type parameters as a tuple
449 *
450 * @warning
451 * Until this proposal https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1985r0.pdf or equivalent is
452 * considered seriously, template traits only work with templates which only have type-parameters. Non-type
453 * parameters even when a default is specified for them will result in compile error.
454 */
455 template <CTypeOnlyTemplate Instance>
457
458 /**
459 * @brief Get a type parameter at a specified position of a templated instance.
460 *
461 * @warning
462 * Until this proposal https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1985r0.pdf or equivalent is
463 * considered seriously, template traits only work with templates which only have type-parameters. Non-type
464 * parameters even when a default is specified for them will result in compile error.
465 */
466 template <CTypeOnlyTemplate Instance, int I>
468
469 /**
470 * @brief Get a decayed type parameter at a specified position of a templated instance.
471 *
472 * @warning
473 * Until this proposal https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1985r0.pdf or equivalent is
474 * considered seriously, template traits only work with templates which only have type-parameters. Non-type
475 * parameters even when a default is specified for them will result in compile error.
476 */
477 template <CTypeOnlyTemplate Instance, int I>
479
480 /**
481 * @brief Check if given type is an instantiation of a given template (which only accepts type parameters)
482 *
483 * @warning
484 * Until this proposal https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1985r0.pdf or equivalent is
485 * considered seriously, template traits only work with templates which only have type-parameters. Non-type
486 * parameters even when a default is specified for them will result in compile error.
487 */
488 template <typename Instance, template <typename...> typename Template>
491 && TTemplate_Match<Template>::template Match<std::decay_t<Instance>>
492 ;
493
494 /**
495 * @brief
496 * Get the number of template type parameters from a specified templated instance (which only has type parameters)
497 *
498 * @warning
499 * Until this proposal https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1985r0.pdf or equivalent is
500 * considered seriously, template traits only work with templates which only have type-parameters. Non-type
501 * parameters even when a default is specified for them will result in compile error.
502 */
503 template <CTypeOnlyTemplate Instance>
505
506 template <template <typename...> typename, typename>
508 {
509 using Type = void;
510 };
511
512 template <
513 template <typename...> typename TemplateOut,
514 template <typename...> typename TemplateIn,
515 typename... Params
516 >
517 struct TTemplateMap_Struct<TemplateOut, TemplateIn<Params...>>
518 {
519 using Type = TemplateOut<Params...>;
520 };
521
522 /**
523 * @brief
524 * Transfer parameters from one template to another. Or in other words replace the template part of the input
525 * template instance with `TemplateOut`.
526 *
527 * @warning
528 * Until this proposal https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1985r0.pdf or equivalent is
529 * considered seriously, template traits only work with templates which only have type-parameters. Non-type
530 * parameters even when a default is specified for them will result in compile error.
531 */
532 template <template <typename...> typename TemplateOut, CTypeOnlyTemplate FromInstance>
534
535 /** @brief Tired of typing `const_cast<FMyLongUnwieldyTypeName>(...)`? use this instead */
536 template <CConstType T>
537 constexpr auto&& AsConst(T&& input) { return FWD(input); }
538
539 /** @brief Tired of typing `const_cast<FMyLongUnwieldyTypeName>(...)`? use this instead */
540 template <CMutableType T>
541 constexpr auto&& AsConst(T&& input) { return FWD(const_cast<const T>(input)); }
542
543 /** @brief Tired of typing `const_cast<FMyLongUnwieldyTypeName>(...)`? use this instead */
544 template <CMutableType T>
545 constexpr auto&& AsMutable(T&& input) { return FWD(input); }
546
547 /** @brief Tired of typing `const_cast<FMyLongUnwieldyTypeName>(...)`? use this instead */
548 template <CConstType T>
549 constexpr auto&& AsMutable(T&& input) { return FWD(const_cast<T>(input)); }
550
551 /** @brief Tired of typing `const_cast<FMyLongUnwieldyTypeName*>(...)`? use this instead */
552 template <typename T>
553 constexpr auto AsConstPtr(const T* input) { return input; }
554
555 /** @brief Tired of typing `const_cast<FMyLongUnwieldyTypeName*>(...)`? use this instead */
556 template <typename T>
557 constexpr auto AsConstPtr(T* input) { return const_cast<const T*>(input); }
558
559 /** @brief Tired of typing `const_cast<FMyLongUnwieldyTypeName*>(...)`? use this instead */
560 template <typename T>
561 constexpr auto AsMutablePtr(T* input) { return input; }
562
563 /** @brief Tired of typing `const_cast<FMyLongUnwieldyTypeName*>(...)`? use this instead */
564 template <typename T>
565 constexpr auto AsMutablePtr(const T* input) { return const_cast<T*>(input); }
566}
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.
Definition Macros.h:100
Check if given type is an instantiation of a given template (which only accepts type parameters)
Definition Templates.h:489
Concept constraining a given type to TTypes
Definition Templates.h:125
Checks if input is a template which only has type parameters.
Definition Templates.h:434
Is given type-list contains all types convertible to the types of another type-list....
Definition Templates.h:367
Is given type-list contains all types convertible to the types of another type-list....
Definition Templates.h:351
consteval bool AnyOfTypeList(bool onEmpty, std::index_sequence< Indices... > &&)
Definition Templates.h:223
consteval bool AnyOfTypeListDecay(bool onEmpty, std::index_sequence< Indices... > &&)
Definition Templates.h:232
consteval bool AllOfTypeList(bool onEmpty, std::index_sequence< Indices... > &&)
Definition Templates.h:205
consteval bool AllOfTypeListDecay(bool onEmpty, std::index_sequence< Indices... > &&)
Definition Templates.h:214
consteval bool IsTypeListConvertibleToDecay(bool onEmpty, std::index_sequence< Indices... > &&)
Definition Templates.h:250
consteval bool IsTypeListConvertibleTo(bool onEmpty, std::index_sequence< Indices... > &&)
Definition Templates.h:241
This namespace provides templating utilities and introspection into template instantiations.
Definition Templates.h:22
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...
Definition Templates.h:59
std::decay_t< typename TTypeAtPack_Struct< sizeof...(Rest) - I - 1, Rest... >::Type > TLastTypeAtPackDecay
Get a specific item from the end of a parameter pack at given index (0 == last) disregarding CV-ref q...
Definition Templates.h:83
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....
Definition Templates.h:75
constexpr size_t TTemplate_ParamCount
Get the number of template type parameters from a specified templated instance (which only has type p...
Definition Templates.h:504
T::template Get< I > TTypes_Get
Definition Templates.h:128
typename TTemplateMap_Struct< TemplateOut, FromInstance >::Type TTemplateMap
Transfer parameters from one template to another. Or in other words replace the template part of the ...
Definition Templates.h:533
constexpr auto AsMutablePtr(T *input)
Tired of typing const_cast<FMyLongUnwieldyTypeName*>(...)? use this instead.
Definition Templates.h:561
typename TTemplate_Struct< Instance >::template ParamDecay< I > TTemplate_ParamDecay
Get a decayed type parameter at a specified position of a templated instance.
Definition Templates.h:478
typename TTemplate_Struct< Instance >::Parameters TTemplate_Params
Get template type parameters as a tuple.
Definition Templates.h:445
constexpr auto && AsMutable(T &&input)
Tired of typing const_cast<FMyLongUnwieldyTypeName>(...)? use this instead.
Definition Templates.h:545
typename TTypesSkip_Struct< Count, T >::Type TTypesSkip
Definition Templates.h:158
typename TTypeAtPack_Struct< sizeof...(Rest) - I - 1, Rest... >::Type TLastTypeAtPack
Get a specific item from the end of a parameter pack at given index (0 == last). It is an unspecified...
Definition Templates.h:67
T::template GetDecay< I > TTypes_GetDecay
Definition Templates.h:131
typename TTemplate_Struct< Instance >::template Param< I > TTemplate_Param
Get a type parameter at a specified position of a templated instance.
Definition Templates.h:467
typename TTypesTrimEnd_Struct< Count, T >::Type TTypesTrimEnd
Definition Templates.h:179
constexpr auto AsConstPtr(const T *input)
Tired of typing const_cast<FMyLongUnwieldyTypeName*>(...)? use this instead.
Definition Templates.h:553
typename TTemplate_Struct< Instance >::ParametersDecay TTemplate_ParamsDecay
Get decayed template type parameters as a tuple.
Definition Templates.h:456
constexpr auto && AsConst(T &&input)
Tired of typing const_cast<FMyLongUnwieldyTypeName>(...)? use this instead.
Definition Templates.h:537
typename TTypesTake_Struct< Count, T >::Type TTypesTake
Definition Templates.h:200
typename TTypeAtPack_Impl< I - 1, Rest... >::Type Type
Definition Templates.h:30
static constexpr bool Value
Definition Templates.h:118
Base struct for matching templates disregarding their arguments.
Definition Templates.h:387
static constexpr bool Match
Definition Templates.h:389
static constexpr bool IsTemplate
Definition Templates.h:398
typename Detail::TTypeAtPack_Impl< I, T... >::Type Type
Definition Templates.h:44
decltype( Compose(std::make_index_sequence< T::Count - Count >{})) Type
Definition Templates.h:149
static consteval TComposeTypeListFrom< T,(Indices+Count)... > Compose(std::index_sequence< Indices... > &&)
decltype( Compose(std::make_index_sequence< Count >{})) Type
Definition Templates.h:191
static consteval TComposeTypeListFrom< T, Indices... > Compose(std::index_sequence< Indices... > &&)
static consteval TComposeTypeListFrom< T, Indices... > Compose(std::index_sequence< Indices... > &&)
decltype( Compose(std::make_index_sequence< T::Count - Count >{})) Type
Definition Templates.h:170
This template is used to store pack of types in other templates, or to allow parameter pack inference...
Definition Templates.h:107
TTypeAtPack< I, T... > Get
Definition Templates.h:111
TTypeAtPackDecay< I, T... > GetDecay
Definition Templates.h:114
static constexpr size_t Count
Definition Templates.h:108