Embedded Template Library 1.0
type_traits_generator.h
Go to the documentation of this file.
1
2
3/******************************************************************************
4The MIT License(MIT)
5
6Embedded Template Library.
7https://github.com/ETLCPP/etl
8https://www.etlcpp.com
9
10Copyright(c) 2014 John Wellbelove
11
12Permission is hereby granted, free of charge, to any person obtaining a copy
13of this software and associated documentation files(the "Software"), to deal
14in the Software without restriction, including without limitation the rights
15to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
16copies of the Software, and to permit persons to whom the Software is
17furnished to do so, subject to the following conditions :
18
19The above copyright notice and this permission notice shall be included in all
20copies or substantial portions of the Software.
21
22THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
25AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28SOFTWARE.
29******************************************************************************/
30
31/*[[[cog
32import cog
33cog.outl("#if 0")
34]]]*/
35/*[[[end]]]*/
36#error THIS HEADER IS A GENERATOR. DO NOT INCLUDE.
37/*[[[cog
38import cog
39cog.outl("#endif")
40]]]*/
41/*[[[end]]]*/
42
43/*[[[cog
44import cog
45cog.outl("//***************************************************************************")
46cog.outl("// THIS FILE HAS BEEN AUTO GENERATED. DO NOT EDIT THIS FILE.")
47cog.outl("//***************************************************************************")
48]]]*/
49/*[[[end]]]*/
50
51//***************************************************************************
52// To generate to header file, run this at the command line.
53// Note: You will need Python and COG installed.
54//
55// python -m cogapp -d -e -otypes.h -DHandlers=<n> types_generator.h
56// Where <n> is the number of types to support.
57//
58// e.g.
59// To generate handlers for up to 16 types...
60// python -m cogapp -d -e -otype_traits.h -DIsOneOf=16 type_traits_generator.h
61//
62// See generate.bat
63//***************************************************************************
64
65#ifndef ETL_TYPE_TRAITS_INCLUDED
66#define ETL_TYPE_TRAITS_INCLUDED
67
68#include "platform.h"
69#include "nullptr.h"
70#include "static_assert.h"
71
72#include <stddef.h>
73#include <stdint.h>
74
79
80#if ETL_USING_STL && ETL_USING_CPP11
81 #include <type_traits>
82#endif
83
84namespace etl
85{
86#if ETL_USING_CPP11
87 template <typename...>
88 using void_t = void;
89#endif
90
91#if ETL_NOT_USING_STL || ETL_CPP11_NOT_SUPPORTED
92
93 //*****************************************************************************
94 // Traits are defined by the ETL
95 //*****************************************************************************
96
97 //***************************************************************************
99 template <typename T, T VALUE>
100 struct integral_constant
101 {
102 static const T value = VALUE;
103
104 typedef T value_type;
105 typedef integral_constant<T, VALUE> type;
106
107 operator value_type() const
108 {
109 return value;
110 }
111 };
112
114 typedef integral_constant<bool, false> false_type;
115 typedef integral_constant<bool, true> true_type;
116
117 template <typename T, T VALUE>
118 const T integral_constant<T, VALUE>::value;
119
120#if ETL_USING_CPP17
121 template <typename T, T VALUE>
122 inline constexpr T integral_constant_v = etl::integral_constant<T, VALUE>::value;
123#endif
124
125#if ETL_USING_CPP11
126 template <bool B>
127 using bool_constant = integral_constant<bool, B>;
128#else
129 template <bool B>
130 struct bool_constant : etl::integral_constant<bool, B> { };
131#endif
132
133#if ETL_USING_CPP17
134 template <bool B>
135 inline constexpr bool bool_constant_v = bool_constant<B>::value;
136#endif
137
138 //***************************************************************************
140 template <typename T>
141 struct negation : etl::bool_constant<!bool(T::value)>
142 {
143 };
144
145#if ETL_USING_CPP17
146 template <typename T>
147 inline constexpr bool negation_v = negation<T>::value;
148#endif
149
150 //***************************************************************************
152 template <typename T> struct remove_reference { typedef T type; };
153 template <typename T> struct remove_reference<T&> { typedef T type; };
154#if ETL_USING_CPP11
155 template <typename T> struct remove_reference<T&&> { typedef T type; };
156#endif
157
158#if ETL_USING_CPP11
159 template <typename T>
160 using remove_reference_t = typename remove_reference<T>::type;
161#endif
162
163 //***************************************************************************
165 template <typename T> struct remove_pointer { typedef T type; };
166 template <typename T> struct remove_pointer<T*> { typedef T type; };
167 template <typename T> struct remove_pointer<const T*> { typedef const T type; };
168 template <typename T> struct remove_pointer<volatile T*> { typedef volatile T type; };
169 template <typename T> struct remove_pointer<const volatile T*> { typedef const volatile T type; };
170 template <typename T> struct remove_pointer<T* const> { typedef T type; };
171 template <typename T> struct remove_pointer<const T* const> { typedef const T type; };
172 template <typename T> struct remove_pointer<volatile T* const> { typedef volatile T type; };
173 template <typename T> struct remove_pointer<const volatile T* const> { typedef const volatile T type; };
174
175#if ETL_USING_CPP11
176 template <typename T>
177 using remove_pointer_t = typename remove_pointer<T>::type;
178#endif
179
180 //***************************************************************************
182 template <typename T> struct add_pointer { typedef typename remove_reference<T>::type* type; };
183
184#if ETL_USING_CPP11
185 template <typename T>
186 using add_pointer_t = typename add_pointer<T>::type;
187#endif
188
189 //***************************************************************************
191 template <typename T> struct is_const : false_type {};
192 template <typename T> struct is_const<const T> : true_type {};
193 template <typename T> struct is_const<const volatile T> : true_type {};
194
195#if ETL_USING_CPP17
196 template <typename T>
197 inline constexpr bool is_const_v = is_const<T>::value;
198#endif
199
200 //***************************************************************************
202 template <typename T> struct remove_const { typedef T type; };
203 template <typename T> struct remove_const<const T> { typedef T type; };
204
205#if ETL_USING_CPP11
206 template <typename T>
207 using remove_const_t = typename remove_const<T>::type;
208#endif
209
210 //***************************************************************************
212 template <typename T> struct add_const { typedef const T type; };
213 template <typename T> struct add_const<const T> { typedef const T type; };
214
215#if ETL_USING_CPP11
216 template <typename T>
217 using add_const_t = typename add_const<T>::type;
218#endif
219
220 //***************************************************************************
222 template <typename T> struct is_volatile : false_type {};
223 template <typename T> struct is_volatile<volatile T> : true_type {};
224 template <typename T> struct is_volatile<const volatile T> : true_type {};
225
226#if ETL_USING_CPP17
227 template <typename T>
228 inline constexpr bool is_volatile_v = is_volatile<T>::value;
229#endif
230
231 //***************************************************************************
233 template <typename T> struct remove_volatile { typedef T type; };
234 template <typename T> struct remove_volatile<volatile T> { typedef T type; };
235
236#if ETL_USING_CPP11
237 template <typename T>
238 using remove_volatile_t = typename remove_volatile<T>::type;
239#endif
240
241 //***************************************************************************
243 template <typename T> struct add_volatile { typedef volatile T type; };
244 template <typename T> struct add_volatile<volatile T> { typedef volatile T type; };
245
246#if ETL_USING_CPP11
247 template <typename T>
248 using add_volatile_t = typename add_volatile<T>::type;
249#endif
250
251 //***************************************************************************
253 template <typename T> struct remove_cv
254 {
255 typedef typename remove_volatile<typename remove_const<T>::type>::type type;
256 };
257
258#if ETL_USING_CPP11
259 template <typename T>
260 using remove_cv_t = typename remove_cv<T>::type;
261#endif
262
263 //***************************************************************************
265 template <typename T> struct add_cv
266 {
267 typedef typename add_volatile<typename add_const<T>::type>::type type;
268 };
269
270#if ETL_USING_CPP11
271 template <typename T>
272 using add_cv_t = typename add_cv<T>::type;
273#endif
274
275 //***************************************************************************
277 template <typename T> struct remove_cvref
278 {
279 typedef typename remove_cv<typename remove_reference<T>::type>::type type;
280 };
281
282#if ETL_USING_CPP11
283 template <typename T>
284 using remove_cvref_t = typename remove_cvref<T>::type;
285#endif
286
287 //***************************************************************************
289 template <typename T> struct is_integral : false_type {};
290 template <> struct is_integral<bool> : true_type {};
291 template <> struct is_integral<char> : true_type {};
292 template <> struct is_integral<unsigned char> : true_type {};
293 template <> struct is_integral<signed char> : true_type {};
294 template <> struct is_integral<wchar_t> : true_type {};
295 template <> struct is_integral<short> : true_type {};
296 template <> struct is_integral<unsigned short> : true_type {};
297 template <> struct is_integral<int> : true_type {};
298 template <> struct is_integral<unsigned int> : true_type {};
299 template <> struct is_integral<long> : true_type {};
300 template <> struct is_integral<unsigned long> : true_type {};
301 template <> struct is_integral<long long> : true_type {};
302 template <> struct is_integral<unsigned long long> : true_type {};
303 template <typename T> struct is_integral<const T> : is_integral<T> {};
304 template <typename T> struct is_integral<volatile T> : is_integral<T> {};
305 template <typename T> struct is_integral<const volatile T> : is_integral<T> {};
306
307#if ETL_USING_CPP17
308 template <typename T>
309 inline constexpr bool is_integral_v = is_integral<T>::value;
310#endif
311
312 //***************************************************************************
314 template <typename T> struct is_signed : false_type {};
315 template <> struct is_signed<char> : etl::bool_constant<(char(255) < 0)> {};
316 template <> struct is_signed<wchar_t> : public etl::bool_constant<static_cast<bool>(wchar_t(-1) < wchar_t(0))> {};
317 template <> struct is_signed<signed char> : true_type {};
318 template <> struct is_signed<short> : true_type {};
319 template <> struct is_signed<int> : true_type {};
320 template <> struct is_signed<long> : true_type {};
321 template <> struct is_signed<long long> : true_type {};
322 template <> struct is_signed<float> : true_type {};
323 template <> struct is_signed<double> : true_type {};
324 template <> struct is_signed<long double> : true_type {};
325 template <typename T> struct is_signed<const T> : is_signed<T> {};
326 template <typename T> struct is_signed<volatile T> : is_signed<T> {};
327 template <typename T> struct is_signed<const volatile T> : is_signed<T> {};
328
329#if ETL_USING_CPP17
330 template <typename T>
331 inline constexpr bool is_signed_v = is_signed<T>::value;
332#endif
333
334 //***************************************************************************
336 template <typename T> struct is_unsigned : false_type {};
337 template <> struct is_unsigned<bool> : true_type {};
338 template <> struct is_unsigned<char> : etl::bool_constant<(char(255) > 0)> {};
339 template <> struct is_unsigned<unsigned char> : true_type {};
340 template <> struct is_unsigned<wchar_t> : public etl::bool_constant<(wchar_t(-1) > wchar_t(0))> {};
341 template <> struct is_unsigned<unsigned short> : true_type {};
342 template <> struct is_unsigned<unsigned int> : true_type {};
343 template <> struct is_unsigned<unsigned long> : true_type {};
344 template <> struct is_unsigned<unsigned long long> : true_type {};
345 template <typename T> struct is_unsigned<const T> : is_unsigned<T> {};
346 template <typename T> struct is_unsigned<volatile T> : is_unsigned<T> {};
347 template <typename T> struct is_unsigned<const volatile T> : is_unsigned<T> {};
348
349#if ETL_USING_CPP17
350 template <typename T>
351 inline constexpr bool is_unsigned_v = is_unsigned<T>::value;
352#endif
353
354 //***************************************************************************
356 template <typename T> struct is_floating_point : false_type {};
357 template <> struct is_floating_point<float> : true_type {};
358 template <> struct is_floating_point<double> : true_type {};
359 template <> struct is_floating_point<long double> : true_type {};
360 template <typename T> struct is_floating_point<const T> : is_floating_point<T> {};
361 template <typename T> struct is_floating_point<volatile T> : is_floating_point<T> {};
362 template <typename T> struct is_floating_point<const volatile T> : is_floating_point<T> {};
363
364#if ETL_USING_CPP17
365 template <typename T>
366 inline constexpr bool is_floating_point_v = is_floating_point<T>::value;
367#endif
368
369 //***************************************************************************
371 template <typename T1, typename T2> struct is_same : public false_type {};
372 template <typename T> struct is_same<T, T> : public true_type {};
373
374#if ETL_USING_CPP17
375 template <typename T1, typename T2>
376 inline constexpr bool is_same_v = is_same<T1, T2>::value;
377#endif
378
379 //***************************************************************************
381 template<typename T> struct is_void : false_type {};
382 template<> struct is_void<void> : true_type {};
383
384#if ETL_USING_CPP17
385 template <typename T>
386 inline constexpr bool is_void_v = is_void<T>::value;
387#endif
388
389 //***************************************************************************
391 template<typename T> struct is_arithmetic : etl::bool_constant<is_integral<T>::value || is_floating_point<T>::value> {};
392
393#if ETL_USING_CPP17
394 template <typename T>
395 inline constexpr bool is_arithmetic_v = is_arithmetic<T>::value;
396#endif
397
398 //***************************************************************************
400 template <typename T> struct is_fundamental : etl::bool_constant<is_arithmetic<T>::value || is_void<T>::value> {};
401
402#if ETL_USING_CPP17
403 template <typename T>
404 inline constexpr bool is_fundamental_v = is_fundamental<T>::value;
405#endif
406
407 //***************************************************************************
409 template <typename T> struct is_compound : etl::bool_constant<!is_fundamental<T>::value> {};
410
411#if ETL_USING_CPP17
412 template <typename T>
413 inline constexpr bool is_compound_v = is_compound<T>::value;
414#endif
415
416 //***************************************************************************
418 template <typename T> struct is_array : false_type {};
419 template <typename T> struct is_array<T[]> : true_type {};
420 template <typename T, size_t MAXN> struct is_array<T[MAXN]> : true_type {};
421
422#if ETL_USING_CPP17
423 template <typename T>
424 inline constexpr bool is_array_v = is_array<T>::value;
425#endif
426
427 //***************************************************************************
429 template<typename T> struct is_pointer_helper : false_type {};
430 template<typename T> struct is_pointer_helper<T*> : true_type {};
431 template<typename T> struct is_pointer : is_pointer_helper<typename remove_cv<T>::type> {};
432
433#if ETL_USING_CPP17
434 template <typename T>
435 inline constexpr bool is_pointer_v = is_pointer<T>::value;
436#endif
437
438 //***************************************************************************
440 template<typename T> struct is_lvalue_reference_helper : false_type {};
441 template<typename T> struct is_lvalue_reference_helper<T&> : true_type {};
442 template<typename T> struct is_lvalue_reference : is_lvalue_reference_helper<typename remove_cv<T>::type> {};
443
444#if ETL_USING_CPP17
445 template <typename T>
446 inline constexpr bool is_lvalue_reference_v = etl::is_lvalue_reference<T>::value;
447#endif
448
449#if ETL_USING_CPP11
450 //***************************************************************************
452 template<typename T> struct is_rvalue_reference_helper : false_type {};
453 template<typename T> struct is_rvalue_reference_helper<T&&> : true_type {};
454 template<typename T> struct is_rvalue_reference : is_rvalue_reference_helper<typename remove_cv<T>::type> {};
455
456#if ETL_USING_CPP17
457 template <typename T>
458 inline constexpr bool is_rvalue_reference_v = etl::is_rvalue_reference<T>::value;
459#endif
460#endif
461
462 //***************************************************************************
464 // Either lvalue or rvalue (for CPP11)
465 template<typename T> struct is_reference : integral_constant<bool,
466 is_lvalue_reference<T>::value
467 #if ETL_USING_CPP11
468 || is_rvalue_reference<T>::value
469 #endif
470 >{};
471
472#if ETL_USING_CPP17
473 template <typename T>
474 inline constexpr bool is_reference_v = is_reference<T>::value;
475#endif
476
477 //***************************************************************************
480 template <typename T> struct is_pod : etl::bool_constant<etl::is_fundamental<T>::value || etl::is_pointer<T>::value> {};
481
482#if ETL_USING_CPP17
483 template <typename T>
484 inline constexpr bool is_pod_v = etl::is_pod<T>::value;
485#endif
486
487 //***************************************************************************
489 template <bool B, typename T, typename F> struct conditional { typedef T type; };
490 template <typename T, typename F> struct conditional<false, T, F> { typedef F type; };
491
492#if ETL_USING_CPP11
493 template <bool B, typename T, typename F>
494 using conditional_t = typename conditional<B, T, F>::type;
495#endif
496
497 //***************************************************************************
499 template <typename T> struct make_signed { typedef T type; };
500 template <> struct make_signed<char> { typedef signed char type; };
501 template <> struct make_signed<unsigned char> { typedef signed char type; };
502
503 template <> struct make_signed<wchar_t>
504 {
505 typedef etl::conditional<sizeof(wchar_t) == sizeof(int16_t),
506 int16_t,
507 etl::conditional<sizeof(wchar_t) == sizeof(int32_t),
508 int32_t,
509 void>::type>::type type;
510 };
511
512 template <> struct make_signed<unsigned short> { typedef short type; };
513 template <> struct make_signed<unsigned int> { typedef int type; };
514 template <> struct make_signed<unsigned long> { typedef long type; };
515 template <> struct make_signed<unsigned long long> { typedef long long type; };
516 template <typename T> struct make_signed<const T> : add_const<typename make_signed<T>::type> {};
517 template <typename T> struct make_signed<volatile T> : add_volatile<typename make_signed<T>::type> {};
518 template <typename T> struct make_signed<const volatile T> : add_const<typename add_volatile<typename make_signed<T>::type>::type> {};
519
520#if ETL_USING_CPP11
521 template <typename T>
522 using make_signed_t = typename make_signed<T>::type;
523#endif
524
525 //***************************************************************************
527 template <typename T> struct make_unsigned { typedef T type; };
528 template <> struct make_unsigned<char> { typedef unsigned char type; };
529 template <> struct make_unsigned<signed char> { typedef unsigned char type; };
530 template <> struct make_unsigned<short> { typedef unsigned short type; };
531
532 template <> struct make_unsigned<wchar_t>
533 {
534 typedef etl::conditional<sizeof(wchar_t) == sizeof(uint16_t),
535 uint16_t,
536 etl::conditional<sizeof(wchar_t) == sizeof(uint32_t),
537 uint32_t,
538 void>::type>::type type;
539 };
540
541 template <> struct make_unsigned<int> { typedef unsigned int type; };
542 template <> struct make_unsigned<long> { typedef unsigned long type; };
543 template <> struct make_unsigned<long long> { typedef unsigned long long type; };
544 template <typename T> struct make_unsigned<const T> : add_const<typename make_unsigned<T>::type> {};
545 template <typename T> struct make_unsigned<volatile T> : add_volatile<typename make_unsigned<T>::type> {};
546 template <typename T> struct make_unsigned<const volatile T> : add_const<typename add_volatile<typename make_unsigned<T>::type>::type> {};
547
548#if ETL_USING_CPP11
549 template <typename T>
550 using make_unsigned_t = typename make_unsigned<T>::type;
551#endif
552
553 //***************************************************************************
555 template <bool B, typename T = void> struct enable_if {};
556 template <typename T> struct enable_if<true, T> { typedef T type; };
557
558#if ETL_USING_CPP11
559 template <bool B, typename T = void>
560 using enable_if_t = typename enable_if<B, T>::type;
561#endif
562
563 //***************************************************************************
565 template <typename T, unsigned MAXN = 0U>
566 struct extent : integral_constant<size_t, 0U> {};
567
568 template <typename T>
569 struct extent<T[], 0> : integral_constant<size_t, 0U> {};
570
571 template <typename T, unsigned MAXN>
572 struct extent<T[], MAXN> : integral_constant<size_t, extent<T, MAXN - 1>::value> {};
573
574 template <typename T, unsigned MAXN>
575 struct extent<T[MAXN], 0> : integral_constant<size_t, MAXN> {};
576
577 template <typename T, unsigned I, unsigned MAXN>
578 struct extent<T[I], MAXN> : integral_constant<size_t, extent<T, MAXN - 1>::value> {};
579
580#if ETL_USING_CPP17
581 template <typename T, unsigned N = 0U>
582 inline constexpr size_t extent_v = extent<T, N>::value;
583#endif
584
585 //***************************************************************************
587 template <typename T> struct remove_extent { typedef T type; };
588 template <typename T> struct remove_extent<T[]> { typedef T type; };
589 template <typename T, size_t MAXN> struct remove_extent<T[MAXN]> { typedef T type; };
590
591#if ETL_USING_CPP11
592 template <typename T>
593 using remove_extent_t = typename remove_extent<T>::type;
594#endif
595
596 //***************************************************************************
598 template <typename T> struct remove_all_extents { typedef T type; };
599 template <typename T> struct remove_all_extents<T[]> { typedef typename remove_all_extents<T>::type type; };
600 template <typename T, size_t MAXN> struct remove_all_extents<T[MAXN]> { typedef typename remove_all_extents<T>::type type; };
601
602#if ETL_USING_CPP11
603 template <typename T>
604 using remove_all_extents_t = typename remove_all_extents<T>::type;
605#endif
606
607 //***************************************************************************
609 template <typename T>struct rank : integral_constant<size_t, 0> {};
610 template <typename T> struct rank<T[]> : public integral_constant<size_t, rank<T>::value + 1> {};
611 template <typename T, size_t MAXN> struct rank<T[MAXN]> : public integral_constant<size_t, rank<T>::value + 1> {};
612
613#if ETL_USING_CPP17
614 template <typename T>
615 inline constexpr size_t rank_v = rank<T>::value;
616#endif
617
618 //***************************************************************************
620 template <typename T>
621 struct decay
622 {
623 typedef typename etl::remove_reference<T>::type U;
625 typename etl::remove_extent<U>::type*,
626 typename etl::remove_cv<U>::type>::type type;
627 };
628
629#if ETL_USING_CPP11
630 template <typename T>
631 using decay_t = typename decay<T>::type;
632#endif
633
634 //***************************************************************************
636 template<typename TBase,
637 typename TDerived,
639 struct is_base_of
640 {
641 private:
642
643 template<typename T> struct dummy {};
644 struct internal: TDerived, dummy<int>{};
645
646 static TBase* check(TBase*) { return (TBase*)0; }
647
648 template<typename T>
649 static char check(dummy<T>*) { return 0; }
650
651 public:
652
653 static const bool value = (sizeof(check((internal*)0)) == sizeof(TBase*));
654 };
655
656 // For when TBase or TDerived is a fundamental type.
657 template<typename TBase, typename TDerived>
658 struct is_base_of<TBase, TDerived, true>
659 {
660 static const bool value = false;
661 };
662
663#if ETL_USING_CPP17
664 template <typename T1, typename T2>
665 inline constexpr bool is_base_of_v = is_base_of<T1, T2>::value;
666#endif
667
668 //***************************************************************************
670 namespace private_type_traits
671 {
672 template <typename T> char test(int T::*); // Match for classes.
673
674 struct dummy { char c[2]; };
675 template <typename T> dummy test(...); // Match for non-classes.
676 }
677
678 template <typename T>
679 struct is_class : etl::bool_constant<sizeof(private_type_traits::test<T>(0)) == 1U> {};
680
681#if ETL_USING_CPP17
682 template <typename T>
683 inline constexpr bool is_class_v = is_class<T>::value;
684#endif
685
686 //***************************************************************************
688 template <typename T> struct add_lvalue_reference { typedef T& type; };
689 template <typename T> struct add_lvalue_reference<T&> { typedef T& type; };
690 template <> struct add_lvalue_reference<void> { typedef void type; };
691 template <> struct add_lvalue_reference<const void> { typedef const void type; };
692 template <> struct add_lvalue_reference<volatile void> { typedef volatile void type; };
693 template <> struct add_lvalue_reference<const volatile void> { typedef const volatile void type; };
694
695#if ETL_USING_CPP11
696 template <typename T>
697 using add_lvalue_reference_t = typename etl::add_lvalue_reference<T>::type;
698#endif
699
700 //***************************************************************************
702#if ETL_USING_CPP11
703 template <typename T> struct add_rvalue_reference { using type = T && ; };
704 template <typename T> struct add_rvalue_reference<T&> { using type = T & ; };
705 template <> struct add_rvalue_reference<void> { using type = void; };
706 template <> struct add_rvalue_reference<const void> { using type = const void; };
707 template <> struct add_rvalue_reference<volatile void> { using type = volatile void; };
708 template <> struct add_rvalue_reference<const volatile void> { using type = const volatile void; };
709#endif
710
711#if ETL_USING_CPP11
712 template <typename T>
713 using add_rvalue_reference_t = typename etl::add_rvalue_reference<T>::type;
714#endif
715
716 //***************************************************************************
718#if ETL_USING_CPP11
719 template <typename T>
720 typename etl::add_rvalue_reference<T>::type declval() ETL_NOEXCEPT;
721#endif
722
723#if ETL_USING_CPP11
724 //***************************************************************************
728
729 namespace private_type_traits
730 {
731 // Base case
732 template <typename T, typename = int>
733 struct is_convertible_to_int : false_type
734 {
735 };
736
737 // Selected if `static_cast<int>(declval<T>())` is a valid statement
738 // 2nd template argument of base case defaults to int to ensure that this partial specialization is always tried first
739 template <typename T>
740 struct is_convertible_to_int<T, decltype(static_cast<int>(declval<T>()))>
741 : true_type
742 {
743 };
744 }
745
746 template <typename T>
747 struct is_enum
748 : integral_constant<bool, private_type_traits::is_convertible_to_int<T>::value &&
749 !is_class<T>::value &&
750 !is_arithmetic<T>::value &&
751 !is_reference<T>::value>
752 {
753 };
754
755#if ETL_USING_CPP17
756 template <typename T>
757 inline constexpr bool is_enum_v = etl::is_enum<T>::value;
758#endif
759
760#endif
761
762 //***************************************************************************
764#if ETL_USING_CPP11
765 namespace private_type_traits
766 {
767 template <typename>
768 using true_type_for = etl::true_type;
769
770 template <typename T>
771 auto returnable(int)->true_type_for<T()>;
772
773 template <typename>
774 auto returnable(...)->etl::false_type;
775
776 template <typename TFrom, typename TTo>
777 auto nonvoid_convertible(int)->true_type_for<decltype(etl::declval<void(&)(TTo)>()(etl::declval<TFrom>()))
778 >;
779 template <typename, typename>
780 auto nonvoid_convertible(...)->etl::false_type;
781 }
782
783#if defined(ETL_COMPILER_ARM5)
784 template <typename TFrom, typename TTo>
785 struct is_convertible : etl::bool_constant<__is_convertible_to(TFrom, TTo)> {};
786#else
787 template <typename TFrom, typename TTo>
788 struct is_convertible : etl::bool_constant<(decltype(private_type_traits::returnable<TTo>(0))::value &&
789 decltype(private_type_traits::nonvoid_convertible<TFrom, TTo>(0))::value) ||
790 (etl::is_void<TFrom>::value && etl::is_void<TTo>::value)> {};
791#endif
792#endif
793
794#if ETL_USING_CPP17
795 template <typename TFrom, typename TTo >
796 inline constexpr bool is_convertible_v = etl::is_convertible<TFrom, TTo>::value;
797#endif
798
799 //***************************************************************************
802#if ETL_USING_CPP11 && !defined(ETL_COMPILER_ARM5)
803 template <typename T> struct alignment_of : integral_constant<size_t, alignof(T)> { };
804#elif defined(ETL_COMPILER_MICROSOFT)
805 template <typename T> struct alignment_of : integral_constant<size_t, size_t(__alignof(T))> {};
806#elif defined(ETL_COMPILER_IAR) || defined(ETL_COMPILER_TI)
807 template <typename T> struct alignment_of : integral_constant<size_t, size_t(__ALIGNOF__(T))> {};
808#else
809 template <typename T> struct alignment_of : integral_constant<size_t, size_t(__alignof__(T))> {};
810#endif
811
814 template <> struct alignment_of<void> : integral_constant <size_t, 0> {};
815 template <> struct alignment_of<const void> : integral_constant <size_t, 0> {};
816
817#if ETL_USING_CPP17
818 template <typename T>
819 inline constexpr size_t alignment_of_v = etl::alignment_of<T>::value;
820#endif
821
822#else // Condition = ETL_USING_STL && ETL_USING_CPP11
823
824//*****************************************************************************
825// Traits are derived from the STL
826//*****************************************************************************
827
828 //***************************************************************************
831 template <typename T, T VALUE>
832 struct integral_constant : std::integral_constant<T, VALUE> {};
833
838
839#if ETL_USING_CPP17
840 template <typename T, T VALUE>
841 inline constexpr T integral_constant_v = std::integral_constant<T, VALUE>::value;
842#endif
843
844#if ETL_USING_CPP17
845 template <bool B>
846 using bool_constant = std::bool_constant<B>;
847#else
848 template <bool B>
849 struct bool_constant : std::integral_constant<bool, B> { };
850#endif
851
852#if ETL_USING_CPP17
853 template <bool B>
854 inline constexpr bool bool_constant_v = bool_constant<B>::value;
855#endif
856
857 //***************************************************************************
860#if ETL_USING_CPP17
861 template <typename T>
862 using negation = std::negation<T>;
863#else
864 template <typename T>
865 struct negation : etl::bool_constant<!bool(T::value)>
866 {
867 };
868#endif
869
870#if ETL_USING_CPP17
871 template <typename T>
872 inline constexpr bool negation_v = std::negation_v<T>;
873#endif
874
875 //***************************************************************************
878 template <typename T> struct remove_reference : std::remove_reference<T> {};
879
880#if ETL_USING_CPP11
881 template <typename T>
882 using remove_reference_t = typename std::remove_reference<T>::type;
883#endif
884
885 //***************************************************************************
888 template <typename T> struct remove_pointer : std::remove_pointer<T> {};
889
890#if ETL_USING_CPP11
891 template <typename T>
892 using remove_pointer_t = typename std::remove_pointer<T>::type;
893#endif
894
895 //***************************************************************************
898 template <typename T> struct add_pointer : std::add_pointer<T> {};
899
900#if ETL_USING_CPP11
901 template <typename T>
902 using add_pointer_t = typename std::add_pointer<T>::type;
903#endif
904
905 //***************************************************************************
908 template <typename T> struct is_const : std::is_const<T> {};
909
910#if ETL_USING_CPP17
911 template <typename T>
912 inline constexpr bool is_const_v = std::is_const_v<T>;
913#endif
914
915 //***************************************************************************
918 template <typename T> struct remove_const : std::remove_const<T> {};
919
920#if ETL_USING_CPP11
921 template <typename T>
922 using remove_const_t = typename std::remove_const<T>::type;
923#endif
924
925 //***************************************************************************
928 template <typename T> struct add_const : std::add_const<T> {};
929
930#if ETL_USING_CPP11
931 template <typename T>
932 using add_const_t = typename std::add_const<T>::type;
933#endif
934
935 //***************************************************************************
938 template <typename T> struct is_volatile : std::is_volatile<T> {};
939
940#if ETL_USING_CPP17
941 template <typename T>
942 inline constexpr bool is_volatile_v = std::is_volatile_v<T>;
943#endif
944
945 //***************************************************************************
948 template <typename T> struct remove_volatile : std::remove_volatile<T> {};
949
950#if ETL_USING_CPP11
951 template <typename T>
952 using remove_volatile_t = typename std::remove_volatile<T>::type;
953#endif
954
955 //***************************************************************************
958 template <typename T> struct add_volatile : std::add_volatile<T> {};
959
960#if ETL_USING_CPP11
961 template <typename T>
962 using add_volatile_t = typename std::add_volatile<T>::type;
963#endif
964
965 //***************************************************************************
968 template <typename T> struct remove_cv : std::remove_cv<T> {};
969
970#if ETL_USING_CPP11
971 template <typename T>
972 using remove_cv_t = typename std::remove_cv<T>::type;
973#endif
974
975 //***************************************************************************
978 template <typename T> struct add_cv : std::add_cv<T> {};
979
980#if ETL_USING_CPP11
981 template <typename T>
982 using add_cv_t = typename std::add_cv<T>::type;
983#endif
984
985 //***************************************************************************
988 template <typename T> struct remove_cvref
989 {
990 typedef typename std::remove_cv<typename std::remove_reference<T>::type>::type type;
991 };
992
993#if ETL_USING_CPP11
994 template <typename T>
995 using remove_cvref_t = typename etl::remove_cvref<T>::type;
996#endif
997
998 //***************************************************************************
1001 template <typename T> struct is_integral : std::is_integral<T> {};
1002
1003#if ETL_USING_CPP17
1004 template <typename T>
1005 inline constexpr bool is_integral_v = std::is_integral_v<T>;
1006#endif
1007
1008 //***************************************************************************
1011 template <typename T> struct is_signed : std::is_signed<T> {};
1012
1013#if ETL_USING_CPP17
1014 template <typename T>
1015 inline constexpr bool is_signed_v = std::is_signed_v<T>;
1016#endif
1017
1018 //***************************************************************************
1021 template <typename T> struct is_unsigned : std::is_unsigned<T> {};
1022
1023#if ETL_USING_CPP17
1024 template <typename T>
1025 inline constexpr bool is_unsigned_v = std::is_unsigned_v<T>;
1026#endif
1027
1028 //***************************************************************************
1031 template <typename T> struct is_floating_point : std::is_floating_point<T> {};
1032
1033#if ETL_USING_CPP17
1034 template <typename T>
1035 inline constexpr bool is_floating_point_v = std::is_floating_point_v<T>;
1036#endif
1037
1038 //***************************************************************************
1041 template <typename T1, typename T2> struct is_same : std::is_same<T1, T2> {};
1042
1043#if ETL_USING_CPP17
1044 template <typename T1, typename T2>
1045 inline constexpr bool is_same_v = std::is_same_v<T1, T2>;
1046#endif
1047
1048 //***************************************************************************
1051 template<typename T> struct is_void : std::is_void<T> {};
1052
1053#if ETL_USING_CPP17
1054 template <typename T>
1055 inline constexpr bool is_void_v = std::is_void_v<T>;
1056#endif
1057
1058 //***************************************************************************
1061 template<typename T> struct is_arithmetic : std::is_arithmetic<T> {};
1062
1063#if ETL_USING_CPP17
1064 template <typename T>
1065 inline constexpr bool is_arithmetic_v = std::is_arithmetic_v<T>;
1066#endif
1067
1068 //***************************************************************************
1071 template <typename T> struct is_fundamental : std::is_fundamental<T> {};
1072
1073#if ETL_USING_CPP17
1074 template <typename T>
1075 inline constexpr bool is_fundamental_v = std::is_fundamental_v<T>;
1076#endif
1077
1078 //***************************************************************************
1081 template <typename T> struct is_compound : std::is_compound<T> {};
1082
1083#if ETL_USING_CPP17
1084 template <typename T>
1085 inline constexpr bool is_compound_v = std::is_compound_v<T>;
1086#endif
1087
1088 //***************************************************************************
1091 template <typename T> struct is_array : std::is_array<T> {};
1092
1093#if ETL_USING_CPP17
1094 template <typename T>
1095 inline constexpr bool is_array_v = std::is_array_v<T>;
1096#endif
1097
1098 //***************************************************************************
1101 template<typename T> struct is_pointer : std::is_pointer<T> {};
1102
1103#if ETL_USING_CPP17
1104 template <typename T>
1105 inline constexpr bool is_pointer_v = std::is_pointer_v<T>;
1106#endif
1107
1108 //***************************************************************************
1111 template<typename T> struct is_reference : std::is_reference<T> {};
1112
1113#if ETL_USING_CPP17
1114 template <typename T>
1115 inline constexpr bool is_reference_v = std::is_reference_v<T>;
1116#endif
1117
1118 //***************************************************************************
1121 template<typename T> struct is_lvalue_reference : std::is_lvalue_reference<T> {};
1122
1123#if ETL_USING_CPP17
1124 template <typename T>
1125 inline constexpr bool is_lvalue_reference_v = std::is_lvalue_reference_v<T>;
1126#endif
1127
1128 //***************************************************************************
1131#if ETL_USING_CPP11
1132 template<typename T> struct is_rvalue_reference : std::is_rvalue_reference<T> {};
1133
1134#if ETL_USING_CPP17
1135 template <typename T>
1136 inline constexpr bool is_rvalue_reference_v = std::is_rvalue_reference_v<T>;
1137#endif
1138#endif
1139
1140 //***************************************************************************
1143 template <typename T>
1144 struct is_pod : std::integral_constant<bool, std::is_standard_layout<T>::value && std::is_trivial<T>::value> {};
1145
1146#if ETL_USING_CPP17
1147 template <typename T>
1148 inline constexpr bool is_pod_v = std::is_standard_layout_v<T> && std::is_trivial_v<T>;
1149#endif
1150
1151#if defined(ETL_COMPILER_GCC)
1152 #if ETL_COMPILER_VERSION >= 5
1153 #define ETL_GCC_V5_TYPE_TRAITS_SUPPORTED
1154 #endif
1155#endif
1156
1157 //***************************************************************************
1160 template <bool B, typename T, typename F> struct conditional { typedef T type; };
1161 template <typename T, typename F> struct conditional<false, T, F> { typedef F type; };
1162
1163#if ETL_USING_CPP11
1164 template <bool B, typename T, typename F>
1165 using conditional_t = typename conditional<B, T, F>::type;
1166#endif
1167
1168 //***************************************************************************
1171 template <typename T> struct make_signed : std::make_signed<T> {};
1172
1173#if ETL_USING_CPP11
1174 template <typename T>
1175 using make_signed_t = typename std::make_signed<T>::type;
1176#endif
1177
1178 //***************************************************************************
1181 template <typename T> struct make_unsigned : std::make_unsigned<T> {};
1182
1183#if ETL_USING_CPP11
1184 template <typename T>
1185 using make_unsigned_t = typename std::make_unsigned<T>::type;
1186#endif
1187
1188 //***************************************************************************
1191 template <bool B, typename T = void> struct enable_if : std::enable_if<B, T> {};
1192
1193#if ETL_USING_CPP11
1194 template <bool B, typename T = void>
1195 using enable_if_t = typename std::enable_if<B, T>::type;
1196#endif
1197
1198 //***************************************************************************
1201 template <typename T, unsigned MAXN = 0U>
1202 struct extent : std::extent<T, MAXN> {};
1203
1204#if ETL_USING_CPP17
1205 template <typename T, unsigned MAXN = 0U>
1206 inline constexpr size_t extent_v = std::extent_v<T, MAXN>;
1207#endif
1208
1209 //***************************************************************************
1212 template <typename T> struct remove_extent : std::remove_extent<T> { };
1213
1214#if ETL_USING_CPP11
1215 template <typename T>
1216 using remove_extent_t = typename std::remove_extent<T>::type;
1217#endif
1218
1219 //***************************************************************************
1222 template <typename T> struct remove_all_extents : std::remove_all_extents<T> { };
1223
1224#if ETL_USING_CPP11
1225 template <typename T>
1226 using remove_all_extents_t = typename std::remove_all_extents<T>::type;
1227#endif
1228
1229 //***************************************************************************
1232 template <typename T>struct rank : std::rank<T> {};
1233
1234#if ETL_USING_CPP17
1235 template <typename T>
1236 inline constexpr size_t rank_v = std::rank_v<T>;
1237#endif
1238
1239 //***************************************************************************
1242 template <typename T> struct decay : std::decay<T> {};
1243
1244#if ETL_USING_CPP11
1245 template <typename T>
1246 using decay_t = typename std::decay<T>::type;
1247#endif
1248
1249 //***************************************************************************
1252 template<typename TBase, typename TDerived> struct is_base_of : std::is_base_of<TBase, TDerived> {};
1253
1254#if ETL_USING_CPP17
1255 template <typename TBase, typename TDerived>
1256 inline constexpr bool is_base_of_v = std::is_base_of_v<TBase, TDerived>;
1257#endif
1258
1259 //***************************************************************************
1261 template <typename T> struct is_class : std::is_class<T>{};
1262
1263#if ETL_USING_CPP17
1264 template <typename T>
1265 inline constexpr bool is_class_v = is_class<T>::value;
1266#endif
1267
1268 //***************************************************************************
1270 template <typename T> struct add_lvalue_reference : std::add_lvalue_reference<T> {};
1271
1272#if ETL_USING_CPP11
1273 template <typename T>
1274 using add_lvalue_reference_t = typename std::add_lvalue_reference<T>::type;
1275#endif
1276
1277 //***************************************************************************
1279#if ETL_USING_CPP11
1280 template <typename T> struct add_rvalue_reference : std::add_rvalue_reference<T> {};
1281#endif
1282
1283#if ETL_USING_CPP11
1284 template <typename T>
1285 using add_rvalue_reference_t = typename std::add_rvalue_reference<T>::type;
1286#endif
1287
1288 //***************************************************************************
1290#if ETL_USING_CPP11
1291 template <typename T>
1292 typename std::add_rvalue_reference<T>::type declval() ETL_NOEXCEPT;
1293#endif
1294
1295#if ETL_USING_CPP11
1296 //***************************************************************************
1299 template <typename T>
1300 struct is_enum : std::is_enum<T>
1301 {
1302 };
1303
1304#if ETL_USING_CPP17
1305 template <typename T>
1306 inline constexpr bool is_enum_v = etl::is_enum<T>::value;
1307#endif
1308
1309#endif
1310
1311 //***************************************************************************
1314#if ETL_USING_CPP11
1315 template <typename TFrom, typename TTo>
1316 struct is_convertible : std::is_convertible<TFrom, TTo> {};
1317#endif
1318
1319#if ETL_USING_CPP17
1320 template <typename TFrom, typename TTo>
1321 inline constexpr bool is_convertible_v = std::is_convertible_v<TFrom, TTo>;
1322#endif
1323
1324 //***************************************************************************
1327 template <typename T> struct alignment_of : std::alignment_of<T> {};
1328 template <> struct alignment_of<void> : std::integral_constant<size_t, 0> {};
1329 template <> struct alignment_of<const void> : std::integral_constant <size_t, 0> {};
1330
1331#if ETL_USING_CPP17
1332 template <typename T>
1333 inline constexpr size_t alignment_of_v = std::alignment_of_v<T>;
1334#endif
1335
1336#endif // Condition = ETL_USING_STL && ETL_USING_CPP11
1337
1338 //***************************************************************************
1339 // ETL extended type traits.
1340 //***************************************************************************
1341
1342 //***************************************************************************
1344 // /\ingroup type_traits
1345 template <bool B, typename T, T TRUE_VALUE, T FALSE_VALUE>
1347
1348 template <typename T, T TRUE_VALUE, T FALSE_VALUE>
1349 struct conditional_integral_constant<true, T, TRUE_VALUE, FALSE_VALUE>
1350 {
1351 ETL_STATIC_ASSERT(etl::is_integral<T>::value, "Not an integral type");
1352 static const T value = TRUE_VALUE;
1353 };
1354
1355 template <typename T, T TRUE_VALUE, T FALSE_VALUE>
1356 struct conditional_integral_constant<false, T, TRUE_VALUE, FALSE_VALUE>
1357 {
1358 ETL_STATIC_ASSERT(etl::is_integral<T>::value, "Not an integral type");
1359 static const T value = FALSE_VALUE;
1360 };
1361
1362#if ETL_USING_CPP11
1363 //***************************************************************************
1366 template <typename T, typename T1, typename... TRest>
1367 struct is_one_of
1368 {
1369 static const bool value = etl::is_same<T, T1>::value ||
1370 etl::is_one_of<T, TRest...>::value;
1371 };
1372
1373 template <typename T, typename T1>
1374 struct is_one_of<T, T1>
1375 {
1376 static const bool value = etl::is_same<T, T1>::value;
1377 };
1378#else
1379 /*[[[cog
1380 import cog
1381 cog.outl("//***************************************************************************")
1382 cog.outl("/// Template to determine if a type is one of a specified list.")
1383 cog.outl("///\ingroup types")
1384 cog.outl("template <typename T,")
1385 cog.out(" ")
1386 cog.out("typename T1, ")
1387 for n in range(2, int(IsOneOf)):
1388 cog.out("typename T%s = void, " % n)
1389 if n % 4 == 0:
1390 cog.outl("")
1391 cog.out(" ")
1392 cog.outl("typename T%s = void>" % IsOneOf)
1393 cog.outl("struct is_one_of")
1394 cog.outl("{")
1395 cog.outl(" static const bool value = ")
1396 for n in range(1, int(IsOneOf)):
1397 cog.outl(" etl::is_same<T, T%s>::value ||" % n)
1398 cog.outl(" etl::is_same<T, T%s>::value;" % IsOneOf)
1399 cog.outl("};")
1400 ]]]*/
1401 /*[[[end]]]*/
1402#endif
1403
1404#if ETL_USING_CPP17
1405 template <typename T, typename... TRest>
1406 inline constexpr bool is_one_of_v = etl::is_one_of<T, TRest...>::value;
1407#endif
1408
1409 //***************************************************************************
1412
1413 // Default.
1414 template <typename T>
1415 struct types
1416 {
1417 private:
1418
1419 typedef typename etl::remove_reference<typename etl::remove_cv<T>::type>::type type_t;
1420
1421 public:
1422
1423 typedef type_t type;
1424 typedef type_t& reference;
1425 typedef const type_t& const_reference;
1426 typedef type_t* pointer;
1427 typedef const type_t* const_pointer;
1428 typedef const type_t* const const_pointer_const;
1429
1430#if ETL_USING_CPP11
1431 typedef type_t&& rvalue_reference;
1432#endif
1433 };
1434
1435 // Pointers.
1436 template <typename T>
1437 struct types<T*>
1438 {
1439 private:
1440
1441 typedef typename etl::remove_reference<typename etl::remove_cv<T>::type>::type type_t;
1442
1443 public:
1444
1445 typedef type_t type;
1446 typedef type_t& reference;
1447 typedef const type_t& const_reference;
1448 typedef type_t* pointer;
1449 typedef const type_t* const_pointer;
1450 typedef const type_t* const const_pointer_const;
1451
1452#if ETL_USING_CPP11
1453 typedef type_t&& rvalue_reference;
1454#endif
1455 };
1456
1457 // Pointers.
1458 template <typename T>
1459 struct types<T* const>
1460 {
1461 private:
1462
1463 typedef typename etl::remove_reference<typename etl::remove_cv<T>::type>::type type_t;
1464
1465 public:
1466
1467 typedef type_t type;
1468 typedef type_t& reference;
1469 typedef const type_t& const_reference;
1470 typedef type_t* pointer;
1471 typedef const type_t* const_pointer;
1472 typedef const type_t* const const_pointer_const;
1473
1474#if ETL_USING_CPP11
1475 typedef type_t&& rvalue_reference;
1476#endif
1477 };
1478
1479 // References.
1480 template <typename T>
1481 struct types<T&>
1482 {
1483 private:
1484
1485 typedef typename etl::remove_reference<typename etl::remove_cv<T>::type>::type type_t;
1486
1487 public:
1488
1489 typedef type_t type;
1490 typedef type_t& reference;
1491 typedef const type_t& const_reference;
1492 typedef type_t* pointer;
1493 typedef const type_t* const_pointer;
1494 typedef const type_t* const const_pointer_const;
1495
1496#if ETL_USING_CPP11
1497 typedef type_t&& rvalue_reference;
1498#endif
1499 };
1500
1501#if ETL_USING_CPP11
1502 // rvalue References.
1503 template <typename T>
1504 struct types<T&&>
1505 {
1506 private:
1507
1508 typedef typename etl::remove_reference<typename etl::remove_cv<T>::type>::type type_t;
1509
1510 public:
1511
1512 typedef type_t type;
1513 typedef type_t& reference;
1514 typedef const type_t& const_reference;
1515 typedef type_t* pointer;
1516 typedef const type_t* const_pointer;
1517 typedef const type_t* const const_pointer_const;
1518
1519#if ETL_USING_CPP11
1520 typedef type_t&& rvalue_reference;
1521#endif
1522 };
1523#endif
1524
1525#if ETL_USING_CPP11
1526 template <typename T>
1527 using types_t = typename types<T>::type;
1528
1529 template <typename T>
1530 using types_r = typename types<T>::reference;
1531
1532 template <typename T>
1533 using types_cr = typename types<T>::const_reference;
1534
1535 template <typename T>
1536 using types_rr = typename types<T>::rvalue_reference;
1537
1538 template <typename T>
1539 using types_p = typename types<T>::pointer;
1540
1541 template <typename T>
1542 using types_cp = typename types<T>::const_pointer;
1543
1544 template <typename T>
1545 using types_cpc = typename types<T>::const_pointer_const;
1546#endif
1547
1548 //***************************************************************************
1551 template <typename T> struct size_of : etl::integral_constant<size_t, sizeof(T)> {};
1552 template <> struct size_of<void> : etl::integral_constant<size_t, 1U> {};
1553
1554#if ETL_USING_CPP17
1555 template <typename T>
1556 inline constexpr size_t size_of_v = etl::size_of<T>::value;
1557#endif
1558
1559#if ETL_USING_CPP11
1560 //***************************************************************************
1562 template <typename T, typename T1, typename... TRest>
1563 struct are_all_same
1564 {
1565 static const bool value = etl::is_same<T, T1>::value &&
1566 etl::are_all_same<T, TRest...>::value;
1567 };
1568
1569 template <typename T, typename T1>
1570 struct are_all_same<T, T1>
1571 {
1572 static const bool value = etl::is_same<T, T1>::value;
1573 };
1574#endif
1575
1576#if ETL_USING_CPP17
1577 template <typename T, typename T1, typename... TRest>
1578 inline constexpr bool are_all_same_v = are_all_same<T, T1, TRest...>::value;
1579#endif
1580
1581 //***************************************************************************
1583#if ETL_USING_CPP11
1584 template <typename...>
1585 struct conjunction : public etl::true_type
1586 {
1587 };
1588
1589 template <typename T1, typename... Tn>
1590 struct conjunction<T1, Tn...> : public etl::conditional_t<bool(T1::value), etl::conjunction<Tn...>, T1>
1591 {
1592 };
1593
1594 template <typename T>
1595 struct conjunction<T> : public T
1596 {
1597 };
1598#endif
1599
1600#if ETL_USING_CPP17
1601 template <typename... T>
1602 inline constexpr bool conjunction_v = conjunction<T...>::value;
1603#endif
1604
1605 //***************************************************************************
1607#if ETL_USING_CPP11
1608 template <typename...>
1609 struct disjunction : public etl::false_type
1610 {
1611 };
1612
1613 template <typename T1, typename... Tn>
1614 struct disjunction<T1, Tn...> : public etl::conditional_t<bool(T1::value), T1, disjunction<Tn...>>
1615 {
1616 };
1617
1618 template <typename T1> struct disjunction<T1> : public T1
1619 {
1620 };
1621#endif
1622
1623#if ETL_USING_CPP17
1624 template <typename... T>
1625 inline constexpr bool disjunction_v = etl::disjunction<T...>::value;
1626#endif
1627
1628 //***************************************************************************
1629#if ETL_USING_STL && ETL_USING_CPP11 && !defined(ETL_USE_TYPE_TRAITS_BUILTINS) && !defined(ETL_USER_DEFINED_TYPE_TRAITS) && ((!defined(ARDUINO) && ETL_NOT_USING_STLPORT) || defined(ETL_GCC_V5_TYPE_TRAITS_SUPPORTED))
1630
1631 //*********************************************
1632 // Use the STL's definitions.
1633 //*********************************************
1634
1635 //*********************************************
1636 // is_assignable
1637 template<typename T1, typename T2>
1638 using is_assignable = std::is_assignable<T1, T2>;
1639
1640 //*********************************************
1641 // is_constructible
1642 template<typename T, typename... TArgs>
1643 using is_constructible = std::is_constructible<T, TArgs...>;
1644
1645 //*********************************************
1646 // is_copy_constructible
1647 template <typename T>
1648 using is_copy_constructible = std::is_copy_constructible<T>;
1649
1650 //*********************************************
1651 // is_move_constructible
1652 template <typename T>
1653 using is_move_constructible = std::is_move_constructible<T>;
1654
1655 //*********************************************
1656 // is_trivially_constructible
1657#if ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED
1658 template <typename T>
1659 using is_trivially_constructible = std::is_trivially_constructible<T>;
1660#else
1661 template <typename T>
1663#endif
1664
1665 //*********************************************
1666 // is_trivially_copy_constructible
1667#if ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED
1668 template <typename T>
1669 using is_trivially_copy_constructible = std::is_trivially_copy_constructible<T>;
1670#else
1671 template <typename T>
1672 using is_trivially_copy_constructible = etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>;
1673#endif
1674
1675 //*********************************************
1676 // is_trivially_destructible
1677#if ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED
1678 template <typename T>
1679 using is_trivially_destructible = std::is_trivially_destructible<T>;
1680#else
1681 template <typename T>
1683#endif
1684
1685 //*********************************************
1686 // is_trivially_copy_assignable
1687#if ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED
1688 template <typename T>
1689 using is_trivially_copy_assignable = std::is_trivially_copy_assignable<T>;
1690#else
1691 template <typename T>
1692 using is_trivially_copy_assignable = etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>;
1693#endif
1694
1695 //*********************************************
1696 // is_trivially_copyable
1697#if ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED
1698 template <typename T>
1699 using is_trivially_copyable = std::is_trivially_copyable<T>;
1700#else
1701 template <typename T>
1703#endif
1704
1705#elif defined(ETL_USE_TYPE_TRAITS_BUILTINS) && !defined(ETL_USER_DEFINED_TYPE_TRAITS)
1706
1707 //*********************************************
1708 // Use the compiler's builtins.
1709 //*********************************************
1710
1711 //*********************************************
1712 // is_assignable
1713 template<typename T1, typename T2>
1714 struct is_assignable
1715 {
1716 static ETL_CONSTANT bool value = __is_assignable(T1, T2);
1717 };
1718
1719#if ETL_USING_CPP11
1720 //*********************************************
1721 // is_constructible
1722 template<typename T, typename... TArgs>
1723 struct is_constructible
1724 {
1725 static ETL_CONSTANT bool value = __is_constructible(T, TArgs...);
1726 };
1727#else
1728 //*********************************************
1729 // is_constructible
1730 template<typename T, typename TArgs = void>
1731 struct is_constructible
1732 {
1733 static ETL_CONSTANT bool value = __is_constructible(T, TArgs);
1734 };
1735
1736 //*********************************************
1737 // is_constructible
1738 template<typename T>
1739 struct is_constructible<T, void>
1740 {
1741 static ETL_CONSTANT bool value = __is_constructible(T);
1742 };
1743#endif
1744
1745 //*********************************************
1746 // is_copy_constructible
1747 template <typename T>
1748 struct is_copy_constructible : public etl::is_constructible<T, typename etl::add_lvalue_reference<const T>::type>
1749 {
1750 };
1751
1752 //*********************************************
1753 // is_move_constructible
1754 template <typename T>
1755 struct is_move_constructible : public etl::is_constructible<T, T>
1756 {
1757 };
1758
1759#if ETL_USING_CPP11
1760 //*********************************************
1761 // is_trivially_constructible
1762 template <typename T, typename... TArgs>
1763 struct is_trivially_constructible
1764 {
1765#if defined(ETL_COMPILER_GCC)
1766 static ETL_CONSTANT bool value = __has_trivial_constructor(T);
1767#else
1768 static ETL_CONSTANT bool value = __is_trivially_constructible(T, TArgs...);
1769#endif
1770 };
1771#else
1772 //*********************************************
1773 // is_trivially_constructible
1774 template <typename T, typename TArgs = void>
1775 struct is_trivially_constructible
1776 {
1777#if defined(ETL_COMPILER_GCC)
1778 static ETL_CONSTANT bool value = __has_trivial_constructor(T);
1779#else
1780 static ETL_CONSTANT bool value = __is_trivially_constructible(T, TArgs);
1781#endif
1782 };
1783
1784 //*********************************************
1785 // is_trivially_constructible
1786 template <typename T>
1787 struct is_trivially_constructible<T, void>
1788 {
1789#if defined(ETL_COMPILER_GCC)
1790 static ETL_CONSTANT bool value = __has_trivial_constructor(T);
1791#else
1792 static ETL_CONSTANT bool value = __is_trivially_constructible(T);
1793#endif
1794 };
1795#endif
1796
1797 //*********************************************
1798 // is_trivially_copy_constructible
1799 template <typename T>
1800 struct is_trivially_copy_constructible : public is_trivially_constructible<T, typename add_lvalue_reference<const T>::type>
1801 {
1802 };
1803
1804 //*********************************************
1805 // is_trivially_destructible
1806 template <typename T>
1807 struct is_trivially_destructible
1808 {
1809#if defined(ETL_COMPILER_GCC)
1810 static ETL_CONSTANT bool value = __has_trivial_destructor(T);
1811#else
1812 static ETL_CONSTANT bool value = __is_trivially_destructible(T);
1813#endif
1814 };
1815
1816 //*********************************************
1817 // is_trivially_copy_assignable
1818 template <typename T>
1819 struct is_trivially_copy_assignable
1820 {
1821#if defined(ETL_COMPILER_GCC)
1822 static ETL_CONSTANT bool value = __has_trivial_copy(T);
1823#else
1824 static ETL_CONSTANT bool value = __is_trivially_copyable(T);
1825#endif
1826 };
1827
1828 //*********************************************
1829 // is_trivially_copyable
1830 template <typename T>
1831 struct is_trivially_copyable
1832 {
1833#if defined(ETL_COMPILER_GCC)
1834 static ETL_CONSTANT bool value = __has_trivial_copy(T);
1835#else
1836 static ETL_CONSTANT bool value = __is_trivially_copyable(T);
1837#endif
1838 };
1839
1840#elif defined(ETL_USER_DEFINED_TYPE_TRAITS) && !defined(ETL_USE_TYPE_TRAITS_BUILTINS)
1841
1842 //*********************************************
1843 // Force the user to provide specialisations for
1844 // anything other than arithmetics and pointers.
1845 //*********************************************
1846
1847 //*********************************************
1848 // is_assignable
1849 template <typename T1,
1850 typename T2,
1852 struct is_assignable;
1853
1854 template <typename T1, typename T2>
1855 struct is_assignable<T1, T2, true> : public etl::true_type
1856 {
1857 };
1858
1859 template <typename T1, typename T2>
1860 struct is_assignable<T1, T2, false>;
1861
1862#if ETL_USING_CPP11
1863 //*********************************************
1864 // is_constructible
1865 template <typename T, bool B, typename... TArgs>
1866 struct is_constructible_helper;
1867
1868 template <typename T, typename... TArgs>
1869 struct is_constructible_helper<T, true, TArgs...> : public etl::true_type
1870 {
1871 };
1872
1873 template <typename T, typename... TArgs>
1874 struct is_constructible_helper<T, false, TArgs...>;
1875
1876 template <typename T, typename... TArgs>
1877 struct is_constructible : public is_constructible_helper<T, etl::is_arithmetic<T>::value || etl::is_pointer<T>::value, TArgs...>
1878 {
1879 };
1880#endif
1881
1882 //*********************************************
1883 // is_copy_constructible
1884 template <typename T, bool B = etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
1885 struct is_copy_constructible;
1886
1887 template <typename T>
1888 struct is_copy_constructible<T, true> : public etl::true_type
1889 {
1890 };
1891
1892 template <typename T>
1893 struct is_copy_constructible<T, false>;
1894
1895 //*********************************************
1896 // is_move_constructible
1897 template <typename T, bool B = etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
1898 struct is_move_constructible;
1899
1900 template <typename T>
1901 struct is_move_constructible<T, true> : public etl::true_type
1902 {
1903 };
1904
1905 template <typename T>
1906 struct is_move_constructible<T, false>;
1907
1908 //*********************************************
1909 // is_trivially_constructible
1910 template <typename T, bool B = etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
1911 struct is_trivially_constructible;
1912
1913 template <typename T>
1914 struct is_trivially_constructible<T, true> : public etl::true_type
1915 {
1916 };
1917
1918 template <typename T>
1919 struct is_trivially_constructible<T, false>;
1920
1921 //*********************************************
1922 // is_trivially_copy_constructible
1923 template <typename T, bool B = etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
1924 struct is_trivially_copy_constructible;
1925
1926 template <typename T>
1927 struct is_trivially_copy_constructible<T, true> : public etl::true_type
1928 {
1929 };
1930
1931 template <typename T>
1932 struct is_trivially_copy_constructible<T, false>;
1933
1934 //*********************************************
1935 // is_trivially_destructible
1936 template <typename T, bool B = etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
1937 struct is_trivially_destructible;
1938
1939 template <typename T>
1940 struct is_trivially_destructible<T, true> : public etl::true_type
1941 {
1942 };
1943
1944 template <typename T>
1945 struct is_trivially_destructible<T, false>;
1946
1947 //*********************************************
1948 // is_trivially_copy_assignable
1949 template <typename T, bool B = etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
1950 struct is_trivially_copy_assignable;
1951
1952 template <typename T>
1953 struct is_trivially_copy_assignable<T, true> : public etl::true_type
1954 {
1955 };
1956
1957 template <typename T>
1958 struct is_trivially_copy_assignable<T, false>;
1959
1960 //*********************************************
1961 // is_trivially_copyable
1962 template <typename T, bool B = etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
1963 struct is_trivially_copyable;
1964
1965 template <typename T>
1966 struct is_trivially_copyable<T, true> : public etl::true_type
1967 {
1968 };
1969
1970 template <typename T>
1971 struct is_trivially_copyable<T, false>;
1972
1973#else
1974
1975 //*********************************************
1976 // Assume that anything other than arithmetics
1977 // and pointers return false for the traits.
1978 //*********************************************
1979
1980 //*********************************************
1981 // is_assignable
1982 template <typename T1, typename T2>
1983 struct is_assignable : public etl::bool_constant<(etl::is_arithmetic<T1>::value || etl::is_pointer<T1>::value) && (etl::is_arithmetic<T2>::value || etl::is_pointer<T2>::value)>
1984 {
1985 };
1986
1987#if ETL_USING_CPP11
1988 //***************************************************************************
1990 namespace private_type_traits
1991 {
1992 template <class, class T, class... Args>
1993 struct is_constructible_ : etl::false_type {};
1994
1995 template <class T, class... Args>
1996 struct is_constructible_<void_t<decltype(T(etl::declval<Args>()...))>, T, Args...> : etl::true_type {};
1997 }
1998
1999 //*********************************************
2000 // is_constructible
2001 template <class T, class... Args>
2002 using is_constructible = private_type_traits::is_constructible_<void_t<>, T, Args...>;
2003
2004 //*********************************************
2005 // is_copy_constructible
2006 template <class T> struct is_copy_constructible : public is_constructible<T, typename etl::add_lvalue_reference<typename etl::add_const<T>::type>::type>{};
2007 template <> struct is_copy_constructible<void> : public false_type{};
2008 template <> struct is_copy_constructible<void const> : public false_type{};
2009 template <> struct is_copy_constructible<void volatile> : public false_type{};
2010 template <> struct is_copy_constructible<void const volatile> : public false_type{};
2011
2012 //*********************************************
2013 // is_move_constructible
2014 template <typename T> struct is_move_constructible: public is_constructible<T, typename etl::add_rvalue_reference<T>::type>{};
2015 template <> struct is_move_constructible<void> : public false_type{};
2016 template <> struct is_move_constructible<void const> : public false_type{};
2017 template <> struct is_move_constructible<void volatile> : public false_type{};
2018 template <> struct is_move_constructible<void const volatile> : public false_type{};
2019
2020#else
2021
2022 //*********************************************
2023 // is_copy_constructible
2024 template <typename T>
2025 struct is_copy_constructible : public etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
2026 {
2027 };
2028
2029 //*********************************************
2030 // is_move_constructible
2031 template <typename T>
2032 struct is_move_constructible : public etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
2033 {
2034 };
2035#endif
2036
2037 //*********************************************
2038 // is_trivially_constructible
2039 template <typename T>
2040 struct is_trivially_constructible : public etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
2041 {
2042 };
2043
2044 //*********************************************
2045 // is_trivially_copy_constructible
2046 template <typename T>
2047 struct is_trivially_copy_constructible : public etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
2048 {
2049 };
2050
2051 //*********************************************
2052 // is_trivially_destructible
2053 template <typename T>
2054 struct is_trivially_destructible : public etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
2055 {
2056 };
2057
2058 //*********************************************
2059 // is_trivially_copy_assignable
2060 template <typename T>
2061 struct is_trivially_copy_assignable : public etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
2062 {
2063 };
2064
2065 //*********************************************
2066 // is_trivially_copyable
2067 template <typename T>
2068 struct is_trivially_copyable : public etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
2069 {
2070 };
2071
2072#endif
2073
2074 template <typename T1, typename T2>
2075 struct is_lvalue_assignable : public etl::is_assignable<typename etl::add_lvalue_reference<T1>::type,
2076 typename etl::add_lvalue_reference<typename etl::add_const<T2>::type>::type>
2077 {
2078 };
2079
2080#if ETL_USING_CPP17
2081
2082 template <typename T1, typename T2>
2083 inline constexpr bool is_assignable_v = etl::is_assignable<T1, T2>::value;
2084
2085 template <typename T1, typename T2>
2086 inline constexpr bool is_lvalue_assignable_v = etl::is_lvalue_assignable<T1, T2>::value;
2087
2088 template<typename T, typename... TArgs>
2089 inline constexpr bool is_constructible_v = etl::is_constructible<T, TArgs...>::value;
2090
2091 template<typename T>
2092 inline constexpr bool is_copy_constructible_v = etl::is_copy_constructible<T>::value;
2093
2094 template<typename T>
2095 inline constexpr bool is_move_constructible_v = etl::is_move_constructible<T>::value;
2096
2097 template <typename T>
2098 inline constexpr bool is_trivially_constructible_v = etl::is_trivially_constructible<T>::value;
2099
2100 template <typename T>
2101 inline constexpr bool is_trivially_copy_constructible_v = etl::is_trivially_copy_constructible<T>::value;
2102
2103 template <typename T>
2104 inline constexpr bool is_trivially_destructible_v = etl::is_trivially_destructible<T>::value;
2105
2106 template <typename T>
2107 inline constexpr bool is_trivially_copy_assignable_v = etl::is_trivially_copy_assignable<T>::value;
2108
2109 template <typename T>
2110 inline constexpr bool is_trivially_copyable_v = etl::is_trivially_copyable<T>::value;
2111
2112#endif
2113
2114#if ETL_USING_CPP11
2115 //*********************************************
2116 // common_type
2117 // Based on the sample implementation detailed on
2118 // https://en.cppreference.com/w/cpp/types/common_type
2119 //*********************************************
2120 //***********************************
2121 // Primary template
2122 template<typename...>
2123 struct common_type
2124 {
2125 };
2126
2127 //***********************************
2128 // One type
2129 template <typename T>
2130 struct common_type<T> : common_type<T, T>
2131 {
2132 };
2133
2134 namespace private_common_type
2135 {
2136 template <typename T1, typename T2>
2137 using conditional_result_t = decltype(false ? declval<T1>() : declval<T2>());
2138
2139 template <typename, typename, typename = void>
2140 struct decay_conditional_result
2141 {
2142 };
2143
2144 template <typename T1, typename T2>
2145 struct decay_conditional_result<T1, T2, void_t<conditional_result_t<T1, T2>>>
2147 {
2148 };
2149
2150 template <typename T1, typename T2, typename = void>
2151 struct common_type_2_impl : decay_conditional_result<const T1&, const T2&>
2152 {
2153 };
2154
2155 template <typename T1, typename T2>
2156 struct common_type_2_impl<T1, T2, void_t<conditional_result_t<T1, T2>>>
2157 : decay_conditional_result<T1, T2>
2158 {
2159 };
2160 }
2161
2162 //***********************************
2163 // Two types
2164 template <typename T1, typename T2>
2165 struct common_type<T1, T2>
2166 : etl::conditional<etl::is_same<T1, typename etl::decay<T1>::type>::value&& etl::is_same<T2, typename etl::decay<T2>::type>::value,
2167 private_common_type::common_type_2_impl<T1, T2>,
2168 common_type<typename etl::decay<T2>::type,
2169 typename etl::decay<T2>::type>>::type
2170 {
2171 };
2172
2173 //***********************************
2174 // Three or more types
2175 namespace private_common_type
2176 {
2177 template <typename AlwaysVoid, typename T1, typename T2, typename... TRest>
2178 struct common_type_multi_impl
2179 {
2180 };
2181
2182 template <typename T1, typename T2, typename... TRest>
2183 struct common_type_multi_impl<void_t<typename common_type<T1, T2>::type>, T1, T2, TRest...>
2184 : common_type<typename common_type<T1, T2>::type, TRest...>
2185 {
2186 };
2187 }
2188
2189 template<typename T1, typename T2, typename... TRest>
2190 struct common_type<T1, T2, TRest...>
2191 : private_common_type::common_type_multi_impl<void, T1, T2, TRest...>
2192 {
2193 };
2194
2195 template <typename... T>
2196 using common_type_t = typename common_type<T...>::type;
2197#endif
2198
2199 //***************************************************************************
2201 //***************************************************************************
2202 template <typename T>
2204 {
2205 typedef typename etl::conditional<sizeof(T) == sizeof(unsigned char), unsigned char,
2206 typename etl::conditional<sizeof(T) == sizeof(unsigned short), unsigned short,
2207 typename etl::conditional<sizeof(T) == sizeof(unsigned int), unsigned int,
2208 typename etl::conditional<sizeof(T) == sizeof(unsigned long), unsigned long,
2209 unsigned long long>::type>::type>::type>::type type;
2210 };
2211
2212#if ETL_USING_CPP11
2213 template <typename T>
2214 using unsigned_type_t = typename unsigned_type<T>::type;
2215#endif
2216
2217 //***************************************************************************
2219 //***************************************************************************
2220 template <typename T>
2222 {
2223 typedef typename etl::conditional<sizeof(T) == sizeof(char), char,
2224 typename etl::conditional<sizeof(T) == sizeof(short), short,
2225 typename etl::conditional<sizeof(T) == sizeof(int), int,
2226 typename etl::conditional<sizeof(T) == sizeof(long), long,
2227 long long>::type>::type>::type>::type type;
2228 };
2229
2230#if ETL_USING_CPP11
2231 template <typename T>
2232 using signed_type_t = typename signed_type<T>::type;
2233#endif
2234}
2235
2236// Helper macros
2237#define ETL_IS_CHAR_TYPE(type) (etl::is_same<char, type>::value || etl::is_same<signed char, type>::value || etl::is_same<unsigned char, type>::value)
2238#define ETL_IS_NOT_CHAR_TYPE(type) (!ETL_IS_CHAR_TYPE(type))
2239
2240#define ETL_IS_POINTER_TYPE(type) (etl::is_pointer<type>::value)
2241#define ETL_IS_NOT_POINTER_TYPE(type) (!ETL_IS_POINTER_TYPE(type))
2242
2243#define ETL_TARGET_IS_TRIVIALLY_COPYABLE(type) (etl::is_trivially_copyable<typename etl::iterator_traits<type>::value_type>::value)
2244#define ETL_TARGET_IS_NOT_TRIVIALLY_COPYABLE(type) (!ETL_TARGET_IS_TRIVIALLY_COPYABLE(type))
2245
2246#endif // ETL_TYPE_TRAITS_INCLUDED
integral_constant< bool, false > false_type
integral_constant specialisations
Definition: type_traits_generator.h:836
add_const
Definition: type_traits_generator.h:928
add_cv
Definition: type_traits_generator.h:978
add_pointer
Definition: type_traits_generator.h:898
add_volatile
Definition: type_traits_generator.h:958
add_rvalue_reference
Definition: type_traits_generator.h:1327
conditional
Definition: type_traits_generator.h:1160
decay
Definition: type_traits_generator.h:1242
enable_if
Definition: type_traits_generator.h:1191
extent
Definition: type_traits_generator.h:1202
integral_constant
Definition: type_traits_generator.h:832
is_arithmetic
Definition: type_traits_generator.h:1061
is_array
Definition: type_traits_generator.h:1091
is_base_of
Definition: type_traits_generator.h:1252
is_compound
Definition: type_traits_generator.h:1081
is_const
Definition: type_traits_generator.h:908
is_floating_point
Definition: type_traits_generator.h:1031
is_fundamental
Definition: type_traits_generator.h:1071
is_integral
Definition: type_traits_generator.h:1001
is_lvalue_reference
Definition: type_traits_generator.h:1121
is_rvalue_reference
Definition: type_traits_generator.h:1144
is_pointer
Definition: type_traits_generator.h:1101
is_reference
Definition: type_traits_generator.h:1111
is_same
Definition: type_traits_generator.h:1041
is_signed
Definition: type_traits_generator.h:1011
is_unsigned
Definition: type_traits_generator.h:1021
is_void
Definition: type_traits_generator.h:1051
is_volatile
Definition: type_traits_generator.h:938
make_signed
Definition: type_traits_generator.h:1171
make_unsigned
Definition: type_traits_generator.h:1181
negation
Definition: type_traits_generator.h:866
rank
Definition: type_traits_generator.h:1232
remove_all_extents
Definition: type_traits_generator.h:1222
remove_const
Definition: type_traits_generator.h:918
remove_cv
Definition: type_traits_generator.h:968
remove_cvref
Definition: type_traits_generator.h:989
remove_extent
Definition: type_traits_generator.h:1212
remove_pointer
Definition: type_traits_generator.h:888
remove_reference
Definition: type_traits_generator.h:878
remove_volatile
Definition: type_traits_generator.h:948
bitset_ext
Definition: absolute.h:38
add_lvalue_reference
Definition: type_traits_generator.h:1270
Definition: type_traits_generator.h:849
conditional_integral_constant
Definition: type_traits_generator.h:1346
conjunction
Definition: type_traits_generator.h:1984
is_class
Definition: type_traits_generator.h:1261
Definition: type_traits_generator.h:2026
Definition: type_traits_generator.h:2077
Definition: type_traits_generator.h:2033
Definition: type_traits.h:1376
Definition: type_traits_generator.h:2041
Definition: type_traits_generator.h:2062
Definition: type_traits_generator.h:2048
Definition: type_traits_generator.h:2069
Definition: type_traits_generator.h:2055
Defines one of five signed types that has the same size as T.
Definition: type_traits_generator.h:2222
size_of
Definition: type_traits_generator.h:1551
A set of templates to allow related types to be derived.
Definition: type_traits_generator.h:1416
Defines one of five unsigned types that has the same size as T.
Definition: type_traits_generator.h:2204
void add_pointer(const volatile void *value, TIString &str, const etl::basic_format_spec< TIString > &format, const bool append)
Helper function for pointers.
Definition: to_string_helper.h:442