41#include "../nth_type.h"
43#include "../static_assert.h"
44#include "../type_list.h"
52#if defined(ETL_COMPILER_KEIL)
53 #pragma diag_suppress 940
54 #pragma diag_suppress 111
57#if ETL_CPP11_NOT_SUPPORTED
58 #if !defined(ETL_IN_UNIT_TEST)
59 #error NOT SUPPORTED FOR C++03 OR BELOW
70 namespace private_variant
79 template <
size_t Index,
typename... TTypes>
80 struct variant_operations;
83 template <
size_t Index>
84 struct variant_operations<Index>
86 static void destroy(
char*,
size_t) {}
87 static void copy(
char*,
const char*,
size_t) {}
88 static void move(
char*,
const char*,
size_t) {}
92 template <
size_t Index,
typename THead,
typename... TRest>
93 struct variant_operations<Index, THead, TRest...>
95 static void destroy(
char* data,
size_t type_id)
99 reinterpret_cast<const THead*
>(
data)->~THead();
103 variant_operations<Index + 1, TRest...>::destroy(data, type_id);
107 static void copy(
char* dst,
const char* src,
size_t type_id)
109 if (type_id == Index)
111 copy_impl(dst, src, etl::integral_constant<
bool, etl::is_copy_constructible<THead>::value>{});
115 variant_operations<Index + 1, TRest...>::copy(dst, src, type_id);
119 static void move(
char* dst,
const char* src,
size_t type_id)
121 if (type_id == Index)
123 move_impl(dst, src, etl::integral_constant<
bool, etl::is_move_constructible<THead>::value>{});
127 variant_operations<Index + 1, TRest...>::move(dst, src, type_id);
133 static void copy_impl(
char* dst,
const char* src, etl::true_type)
135 ::new (dst) THead(*
reinterpret_cast<const THead*
>(src));
140 static void move_impl(
char* dst,
const char* src, etl::true_type)
142 ::new (dst) THead(etl::move(*
reinterpret_cast<THead*
>(
const_cast<char*
>(src))));
151 template <
typename... TTypes>
152 struct are_all_trivially_destructible : etl::conjunction<etl::is_trivially_destructible<TTypes>...>
160 template <
typename... TTypes>
161 union variadic_union;
165 union variadic_union<>
167 constexpr variadic_union() ETL_NOEXCEPT {}
171 template <
typename THead,
typename... TRest>
172 union variadic_union<THead, TRest...>
175 variadic_union<TRest...> tail;
177 constexpr variadic_union() ETL_NOEXCEPT
183 template <
typename T>
184 constexpr variadic_union(etl::in_place_index_t<0>, T&& value)
185 : head(etl::forward<T>(value))
190 template <
size_t Index,
typename T>
191 constexpr variadic_union(etl::in_place_index_t<Index>, T&& value)
192 : tail(etl::in_place_index_t<Index - 1>{}, etl::forward<T>(value))
201 template <
size_t Index,
typename THead,
typename... TRest>
202 ETL_CONSTEXPR14
typename etl::enable_if_t<(Index == 0), THead&> variadic_union_get(variadic_union<THead, TRest...>& u) ETL_NOEXCEPT
207 template <
size_t Index,
typename THead,
typename... TRest>
208 ETL_CONSTEXPR14
typename etl::enable_if_t<(Index != 0), etl::nth_type_t<Index, THead, TRest...>&>
209 variadic_union_get(variadic_union<THead, TRest...>& u) ETL_NOEXCEPT
211 return variadic_union_get<Index - 1>(u.tail);
215 template <
size_t Index,
typename THead,
typename... TRest>
216 constexpr typename etl::enable_if_t<(Index == 0),
const THead&> variadic_union_get(
const variadic_union<THead, TRest...>& u) ETL_NOEXCEPT
221 template <
size_t Index,
typename THead,
typename... TRest>
222 constexpr typename etl::enable_if_t<(Index != 0),
const etl::nth_type_t<Index, THead, TRest...>&>
223 variadic_union_get(
const variadic_union<THead, TRest...>& u) ETL_NOEXCEPT
225 return variadic_union_get<Index - 1>(u.tail);
229 template <
size_t Index,
typename THead,
typename... TRest>
230 ETL_CONSTEXPR14
typename etl::enable_if_t<(Index == 0), THead&&> variadic_union_get(variadic_union<THead, TRest...>&& u) ETL_NOEXCEPT
232 return etl::move(u.head);
235 template <
size_t Index,
typename THead,
typename... TRest>
236 ETL_CONSTEXPR14
typename etl::enable_if_t<(Index != 0), etl::nth_type_t<Index, THead, TRest...>&&>
237 variadic_union_get(variadic_union<THead, TRest...>&& u) ETL_NOEXCEPT
239 return variadic_union_get<Index - 1>(etl::move(u.tail));
243 template <
size_t Index,
typename THead,
typename... TRest>
244 constexpr typename etl::enable_if_t<(Index == 0),
const THead&&> variadic_union_get(
const variadic_union<THead, TRest...>&& u) ETL_NOEXCEPT
246 return etl::move(u.head);
249 template <
size_t Index,
typename THead,
typename... TRest>
250 constexpr typename etl::enable_if_t<(Index != 0),
const etl::nth_type_t<Index, THead, TRest...>&&>
251 variadic_union_get(
const variadic_union<THead, TRest...>&& u) ETL_NOEXCEPT
253 return variadic_union_get<Index - 1>(etl::move(u.tail));
258 constexpr size_t variant_npos = etl::integral_limits<size_t>::max;
262 template <
typename... TTypes>
268 template <
size_t Index,
typename T>
271 template <
size_t Index,
typename... TTypes>
274 using type = etl::nth_type_t<Index, TTypes...>;
277 template <
size_t Index,
typename T>
280 using type =
typename variant_alternative<Index, T>::type;
283 template <
size_t Index,
typename T>
284 using variant_alternative_t =
typename variant_alternative<Index, T>::type;
288 template <
typename T,
typename... TTypes>
289 ETL_CONSTEXPR14
bool holds_alternative(
const etl::variant<TTypes...>& v) ETL_NOEXCEPT;
293 template <
size_t Index,
typename... VTypes>
294 ETL_CONSTEXPR14 etl::variant_alternative_t<Index, etl::variant<VTypes...> >&
get(etl::variant<VTypes...>& v);
296 template <
size_t Index,
typename... VTypes>
297 ETL_CONSTEXPR14 etl::variant_alternative_t<Index, etl::variant<VTypes...> >&&
get(etl::variant<VTypes...>&& v);
299 template <
size_t Index,
typename... VTypes>
300 ETL_CONSTEXPR14
const etl::variant_alternative_t<Index,
const etl::variant<VTypes...> >&
get(
const etl::variant<VTypes...>& v);
302 template <
size_t Index,
typename... VTypes>
303 ETL_CONSTEXPR14
const etl::variant_alternative_t<Index,
const etl::variant<VTypes...> >&&
get(
const etl::variant<VTypes...>&& v);
305 template <
typename T,
typename... VTypes>
306 ETL_CONSTEXPR14 T&
get(etl::variant<VTypes...>& v);
308 template <
typename T,
typename... VTypes>
309 ETL_CONSTEXPR14 T&&
get(etl::variant<VTypes...>&& v);
311 template <
typename T,
typename... VTypes>
312 ETL_CONSTEXPR14
const T&
get(
const etl::variant<VTypes...>& v);
314 template <
typename T,
typename... VTypes>
315 ETL_CONSTEXPR14
const T&&
get(
const etl::variant<VTypes...>&& v);
317 #if ETL_NOT_USING_CPP17
318 #include "variant_select_do_operator.h"
319 #include "variant_select_do_visitor.h"
346 #if ETL_USING_CPP20 && ETL_USING_STL && !(defined(ETL_DEVELOPMENT_OS_APPLE) && defined(ETL_COMPILER_CLANG))
349 return std::strong_ordering::equal;
353 #if ETL_NOT_USING_STL && !defined(ETL_USE_TYPE_TRAITS_BUILTINS)
355 struct is_copy_constructible<etl::
monostate> :
public etl::true_type
360 struct is_move_constructible<etl::
monostate> :
public etl::true_type
373 variant_exception(string_type reason_, string_type file_name_, numeric_type line_number_)
374 :
exception(reason_, file_name_, line_number_)
387 variant_incorrect_type_exception(string_type file_name_, numeric_type line_number_)
388 : variant_exception(ETL_ERROR_TEXT(
"variant:unsupported type", ETL_VARIANT_FILE_ID
"A"), file_name_, line_number_)
401 bad_variant_access(string_type file_name_, numeric_type line_number_)
402 : variant_exception(ETL_ERROR_TEXT(
"variant:bad variant access", ETL_VARIANT_FILE_ID
"B"), file_name_, line_number_)
407 namespace private_variant
414 template <
bool IsAllTriviallyDestructible,
typename... TTypes>
417 using largest_t =
typename largest_type<TTypes...>::type;
418 static const size_t Size =
sizeof(largest_t);
419 static const size_t Alignment = etl::largest_alignment<TTypes...>::value;
421 etl::uninitialized_buffer<Size, 1U, Alignment>
data;
424 ETL_CONSTEXPR14 variant_base() noexcept
425 : type_id(variant_npos)
429 ETL_CONSTEXPR14 variant_base(
size_t id) noexcept
436 if (type_id != variant_npos)
438 variant_operations<0, TTypes...>::destroy(data, type_id);
440 type_id = variant_npos;
451 template <
typename... TTypes>
452 struct variant_base<true, TTypes...>
454 variadic_union<TTypes...>
data;
457 constexpr variant_base() noexcept
459 , type_id(variant_npos)
463 constexpr variant_base(
size_t id) noexcept
469 template <
size_t Index,
typename T>
470 constexpr variant_base(etl::in_place_index_t<Index>, T&& value,
471 size_t id)
noexcept(etl::is_nothrow_constructible<etl::nth_type_t<Index, TTypes...>, T>::value)
472 :
data(etl::in_place_index_t<Index>{}, etl::forward<T>(value))
477 ~variant_base() =
default;
485 template <
typename... TTypes>
486 class variant :
private private_variant::variant_base<private_variant::are_all_trivially_destructible<TTypes...>::value, TTypes...>
488 using base_type = private_variant::variant_base<private_variant::are_all_trivially_destructible<TTypes...>::value, TTypes...>;
490 static constexpr bool Is_Trivially_Destructible_Suite = private_variant::are_all_trivially_destructible<TTypes...>::value;
494 using type_list = etl::type_list<TTypes...>;
499 template <
size_t Index,
typename... VTypes>
500 friend ETL_CONSTEXPR14 etl::variant_alternative_t<Index, etl::variant<VTypes...> >&
get(etl::variant<VTypes...>& v);
502 template <
size_t Index,
typename... VTypes>
503 friend ETL_CONSTEXPR14 etl::variant_alternative_t<Index, etl::variant<VTypes...> >&&
get(etl::variant<VTypes...>&& v);
505 template <
size_t Index,
typename... VTypes>
506 friend ETL_CONSTEXPR14
const etl::variant_alternative_t<Index,
const etl::variant<VTypes...> >&
get(
const etl::variant<VTypes...>& v);
508 template <
size_t Index,
typename... VTypes>
509 friend ETL_CONSTEXPR14
const etl::variant_alternative_t<Index,
const etl::variant<VTypes...> >&&
get(
const etl::variant<VTypes...>&& v);
511 template <
typename T,
typename... VTypes>
512 friend ETL_CONSTEXPR14 T&
get(etl::variant<VTypes...>& v);
514 template <
typename T,
typename... VTypes>
515 friend ETL_CONSTEXPR14 T&&
get(etl::variant<VTypes...>&& v);
517 template <
typename T,
typename... VTypes>
518 friend ETL_CONSTEXPR14
const T&
get(
const etl::variant<VTypes...>& v);
520 template <
typename T,
typename... VTypes>
521 friend ETL_CONSTEXPR14
const T&&
get(
const etl::variant<VTypes...>&& v);
523 template <
class T,
typename... VTypes >
524 friend ETL_CONSTEXPR14 etl::add_pointer_t<T> get_if(etl::variant<VTypes...>* pv) ETL_NOEXCEPT;
526 template <
class T,
typename... VTypes >
527 friend ETL_CONSTEXPR14 etl::add_pointer_t<const T> get_if(
const etl::variant<VTypes...>* pv) ETL_NOEXCEPT;
534 template <
typename T>
535 using index_of_type = etl::type_list_index_of_type<etl::type_list<TTypes...>, etl::remove_cvref_t<T> >;
540 template <
size_t Index>
541 using type_from_index =
typename etl::type_list_type_at_index<etl::type_list<TTypes...>, Index>::type;
546 using base_type::data;
547 using base_type::type_id;
556 template <
bool Trivial = Is_Trivially_Destructible_Suite, etl::enable_if_t<!Trivial,
int> = 0>
557 ETL_CONSTEXPR14 variant() noexcept(etl::is_nothrow_default_constructible<type_from_index<0U> >::value)
559 using type = type_from_index<0U>;
561 default_construct_in_place<type>(data);
565 template <
bool Trivial = Is_Trivially_Destructible_Suite, etl::enable_if_t<Trivial,
int> = 0>
566 constexpr variant() noexcept(etl::is_nothrow_default_constructible<type_from_index<0U> >::value)
567 : base_type(etl::in_place_index_t<0>{}, type_from_index<0U>{}, 0U)
576 template <
typename T,
bool Trivial_ = Is_Trivially_Destructible_Suite,
577 etl::enable_if_t<!etl::is_same<etl::remove_cvref_t<T>, variant>::value && !Trivial_,
int> = 0>
578 ETL_CONSTEXPR14 variant(T&& value)
579 : base_type(index_of_type<T>::value)
581 static_assert(etl::is_one_of<etl::remove_cvref_t<T>, TTypes...>::value,
"Unsupported type");
583 construct_in_place<etl::remove_cvref_t<T> >(data, etl::forward<T>(value));
586 template <
typename T,
bool Trivial_ = Is_Trivially_Destructible_Suite,
587 etl::enable_if_t<!etl::is_same<etl::remove_cvref_t<T>, variant>::value && Trivial_,
int> = 0>
588 constexpr variant(T&& value)
589 : base_type(etl::in_place_index_t<index_of_type<T>::value>{}, etl::forward<T>(value), index_of_type<T>::value)
591 static_assert(etl::is_one_of<etl::remove_cvref_t<T>, TTypes...>::value,
"Unsupported type");
599 template <
typename T,
typename... TArgs,
bool Trivial_ = Is_Trivially_Destructible_Suite, etl::enable_if_t<!Trivial_, int> = 0>
600 ETL_CONSTEXPR14
explicit variant(etl::in_place_type_t<T>, TArgs&&... args)
601 : base_type(index_of_type<T>::value)
603 static_assert(etl::is_one_of<etl::remove_cvref_t<T>, TTypes...>::value,
"Unsupported type");
605 construct_in_place_args<etl::remove_cvref_t<T> >(data, etl::forward<TArgs>(args)...);
608 template <
typename T,
typename... TArgs,
bool Trivial_ = Is_Trivially_Destructible_Suite, etl::enable_if_t<Trivial_, int> = 0>
609 constexpr explicit variant(etl::in_place_type_t<T>, TArgs&&... args)
610 : base_type(etl::in_place_index_t<index_of_type<T>::value>{}, etl::remove_cvref_t<T>(etl::forward<TArgs>(args)...), index_of_type<T>::value)
612 static_assert(etl::is_one_of<etl::remove_cvref_t<T>, TTypes...>::value,
"Unsupported type");
620 template <
size_t Index,
typename... TArgs,
bool Trivial_ = Is_Trivially_Destructible_Suite, etl::enable_if_t<!Trivial_, int> = 0>
621 ETL_CONSTEXPR14
explicit variant(etl::in_place_index_t<Index>, TArgs&&... args)
624 using type = type_from_index<Index>;
625 static_assert(etl::is_one_of<type, TTypes...>::value,
"Unsupported type");
627 construct_in_place_args<type>(data, etl::forward<TArgs>(args)...);
630 template <
size_t Index,
typename... TArgs,
bool Trivial_ = Is_Trivially_Destructible_Suite, etl::enable_if_t<Trivial_, int> = 0>
631 constexpr explicit variant(etl::in_place_index_t<Index>, TArgs&&... args)
632 : base_type(etl::in_place_index_t<Index>{}, type_from_index<Index>(etl::forward<TArgs>(args)...), Index)
634 using type = type_from_index<Index>;
635 static_assert(etl::is_one_of<type, TTypes...>::value,
"Unsupported type");
639 #if ETL_HAS_INITIALIZER_LIST
644 template <
typename T,
typename U,
typename... TArgs >
645 ETL_CONSTEXPR14
explicit variant(etl::in_place_type_t<T>, std::initializer_list<U> init, TArgs&&... args)
646 : base_type(index_of_type<T>::value)
648 static_assert(etl::is_one_of<etl::remove_cvref_t<T>, TTypes...>::value,
"Unsupported type");
650 construct_in_place_args<etl::remove_cvref_t<T> >(data, init, etl::forward<TArgs>(args)...);
658 template <
size_t Index,
typename U,
typename... TArgs >
659 ETL_CONSTEXPR14
explicit variant(etl::in_place_index_t<Index>, std::initializer_list<U> init, TArgs&&... args)
662 using type = type_from_index<Index>;
663 static_assert(etl::is_one_of<type, TTypes...>::value,
"Unsupported type");
665 construct_in_place_args<type>(data, init, etl::forward<TArgs>(args)...);
675 ETL_CONSTEXPR14 variant(
const variant& other)
noexcept(etl::conjunction<etl::is_nothrow_copy_constructible<TTypes>...>::value)
676 : base_type(other.type_id)
678 if (other.index() != variant_npos)
680 do_copy_from(other, etl::integral_constant<bool, Is_Trivially_Destructible_Suite>{});
690 ETL_CONSTEXPR14
variant(
variant&& other)
noexcept(etl::conjunction<etl::is_nothrow_move_constructible<TTypes>...>::value)
691 : base_type(other.type_id)
693 if (other.index() != variant_npos)
695 do_move_from(other, etl::integral_constant<bool, Is_Trivially_Destructible_Suite>{});
710 template <
typename T,
typename... TArgs>
711 T& emplace(TArgs&&... args) ETL_NOEXCEPT_IF((etl::is_nothrow_constructible<etl::remove_cvref_t<T>, TArgs...>::value))
713 static_assert(etl::is_one_of<T, TTypes...>::value,
"Unsupported type");
715 using type = etl::remove_cvref_t<T>;
718 do_emplace<type>(etl::forward<TArgs>(args)...);
720 type_id = index_of_type<T>::value;
722 return get_value<index_of_type<T>::value>();
725 #if ETL_HAS_INITIALIZER_LIST
729 template <
typename T,
typename U,
typename... TArgs>
730 T& emplace(std::initializer_list<U> il, TArgs&&... args)
731 ETL_NOEXCEPT_IF((etl::is_nothrow_constructible<etl::remove_cvref_t<T>, std::initializer_list<U>, TArgs...>::value))
733 static_assert(etl::is_one_of<T, TTypes...>::value,
"Unsupported type");
735 using type = etl::remove_cvref_t<T>;
738 do_emplace<type>(il, etl::forward<TArgs>(args)...);
740 type_id = index_of_type<T>::value;
742 return get_value<index_of_type<T>::value>();
749 template <
size_t Index,
typename... TArgs>
750 typename etl::variant_alternative_t<Index, variant<TTypes...> >& emplace(TArgs&&... args)
751 ETL_NOEXCEPT_IF((etl::is_nothrow_constructible<type_from_index<Index>, TArgs...>::value))
753 static_assert(Index <
sizeof...(TTypes),
"Index out of range");
755 using type = type_from_index<Index>;
758 do_emplace<type>(etl::forward<TArgs>(args)...);
762 return get_value<Index>();
765 #if ETL_HAS_INITIALIZER_LIST
769 template <
size_t Index,
typename U,
typename... TArgs>
770 typename etl::variant_alternative_t<Index, variant<TTypes...> >& emplace(std::initializer_list<U> il, TArgs&&... args)
771 ETL_NOEXCEPT_IF((etl::is_nothrow_constructible<type_from_index<Index>, std::initializer_list<U>, TArgs...>::value))
773 static_assert(Index <
sizeof...(TTypes),
"Index out of range");
775 using type = type_from_index<Index>;
778 do_emplace<type>(il, etl::forward<TArgs>(args)...);
782 return get_value<Index>();
790 template <
typename T, etl::enable_if_t<!etl::is_same<etl::remove_cvref_t<T>, variant>::value,
int> = 0>
791 variant& operator=(T&& value)
793 using type = etl::remove_cvref_t<T>;
795 static_assert(etl::is_one_of<
type, TTypes...>::value,
"Unsupported type");
798 do_construct<type>(etl::forward<T>(value));
800 type_id = index_of_type<type>::value;
809 variant& operator=(
const variant& other) ETL_NOEXCEPT_IF((etl::conjunction<etl::is_nothrow_copy_constructible<TTypes>...>::value))
813 if (other.index() == variant_npos)
815 type_id = variant_npos;
823 type_id = other.type_id;
834 variant& operator=(variant&& other) ETL_NOEXCEPT_IF((etl::conjunction<etl::is_nothrow_move_constructible<TTypes>...>::value))
838 if (other.index() == variant_npos)
840 type_id = variant_npos;
848 type_id = other.type_id;
859 constexpr bool valueless_by_exception() const ETL_NOEXCEPT
861 return type_id == variant_npos;
867 constexpr size_t index() const ETL_NOEXCEPT
877 template <
typename T>
878 static constexpr bool is_supported_type()
880 return etl::is_one_of<etl::remove_cvref_t<T>, TTypes...>::value;
888 template <typename T, etl::enable_if_t<is_supported_type<T>(),
int> = 0>
889 constexpr bool is_type() const ETL_NOEXCEPT
891 return (type_id == index_of_type<T>::value);
895 template <typename T, etl::enable_if_t<!is_supported_type<T>(),
int> = 0>
896 constexpr bool is_type() const ETL_NOEXCEPT
907 constexpr bool is_same_type(
const variant& other)
const
909 return type_id == other.type_id;
915 void swap(variant& rhs) ETL_NOEXCEPT
917 variant temp(etl::move(*
this));
918 *
this = etl::move(rhs);
919 rhs = etl::move(temp);
925 template <
typename TVisitor>
926 etl::enable_if_t<etl::is_visitor<TVisitor>::value,
void> accept(TVisitor& v)
928 #if ETL_USING_CPP17 && !defined(ETL_VARIANT_FORCE_CPP11)
929 do_visitor(v, etl::make_index_sequence<
sizeof...(TTypes)>{});
931 do_visitor<
sizeof...(TTypes)>(v);
938 template <
typename TVisitor>
939 etl::enable_if_t<etl::is_visitor<TVisitor>::value,
void> accept(TVisitor& v)
const
941 #if ETL_USING_CPP17 && !defined(ETL_VARIANT_FORCE_CPP11)
942 do_visitor(v, etl::make_index_sequence<
sizeof...(TTypes)>{});
944 do_visitor<
sizeof...(TTypes)>(v);
951 template <
typename TVisitor>
952 etl::enable_if_t<!etl::is_visitor<TVisitor>::value,
void> accept(TVisitor& v)
954 #if ETL_USING_CPP17 && !defined(ETL_VARIANT_FORCE_CPP11)
955 do_operator(v, etl::make_index_sequence<
sizeof...(TTypes)>{});
957 do_operator<
sizeof...(TTypes)>(v);
964 template <
typename TVisitor>
965 etl::enable_if_t<!etl::is_visitor<TVisitor>::value,
void> accept(TVisitor& v)
const
967 #if ETL_USING_CPP17 && !defined(ETL_VARIANT_FORCE_CPP11)
968 do_operator(v, etl::make_index_sequence<
sizeof...(TTypes)>{});
970 do_operator<
sizeof...(TTypes)>(v);
978 template <
typename TVisitor>
979 #if !defined(ETL_IN_UNIT_TEST)
980 ETL_DEPRECATED_REASON(
"Replace with accept()")
983 accept_visitor(TVisitor& v)
985 #if ETL_USING_CPP17 && !defined(ETL_VARIANT_FORCE_CPP11)
986 do_visitor(v, etl::make_index_sequence<
sizeof...(TTypes)>{});
988 do_visitor<
sizeof...(TTypes)>(v);
996 template <
typename TVisitor>
997 #if !defined(ETL_IN_UNIT_TEST)
998 ETL_DEPRECATED_REASON(
"Replace with accept()")
1001 accept_visitor(TVisitor& v)
const
1003 #if ETL_USING_CPP17 && !defined(ETL_VARIANT_FORCE_CPP11)
1004 do_visitor(v, etl::make_index_sequence<
sizeof...(TTypes)>{});
1006 do_visitor<
sizeof...(TTypes)>(v);
1014 template <
typename TVisitor>
1015 #if !defined(ETL_IN_UNIT_TEST)
1016 ETL_DEPRECATED_REASON(
"Replace with accept()")
1019 accept_functor(TVisitor& v)
1021 #if ETL_USING_CPP17 && !defined(ETL_VARIANT_FORCE_CPP11)
1022 do_operator(v, etl::make_index_sequence<
sizeof...(TTypes)>{});
1024 do_operator<
sizeof...(TTypes)>(v);
1032 template <
typename TVisitor>
1033 #if !defined(ETL_IN_UNIT_TEST)
1034 ETL_DEPRECATED_REASON(
"Replace with accept()")
1037 accept_functor(TVisitor& v)
const
1039 #if ETL_USING_CPP17 && !defined(ETL_VARIANT_FORCE_CPP11)
1040 do_operator(v, etl::make_index_sequence<
sizeof...(TTypes)>{});
1042 do_operator<
sizeof...(TTypes)>(v);
1051 template <
typename T,
typename U>
1052 static void construct_in_place(
char* pstorage, U&& value)
1054 using type = etl::remove_cvref_t<T>;
1056 ::new (pstorage)
type(etl::forward<U>(value));
1062 template <
typename T,
typename... TArgs>
1063 static void construct_in_place_args(
char* pstorage, TArgs&&... args)
1065 using type = etl::remove_cvref_t<T>;
1067 ::new (pstorage)
type(etl::forward<TArgs>(args)...);
1073 template <
typename T>
1074 static void default_construct_in_place(
char* pstorage) ETL_NOEXCEPT_IF((etl::is_nothrow_default_constructible<etl::remove_cvref_t<T> >::value))
1076 using type = etl::remove_cvref_t<T>;
1078 ::new (pstorage)
type();
1096 private_variant::variant_operations<0, TTypes...>::destroy(data, type_id);
1103 template <
typename T,
typename... TArgs>
1104 void do_emplace(TArgs&&... args)
1112 template <
typename T,
typename... TArgs>
1115 ::new (
static_cast<void*
>(
etl::addressof(private_variant::variadic_union_get<index_of_type<T>::value>(data)))) T(etl::forward<TArgs>(args)...);
1119 template <
typename T,
typename... TArgs>
1122 ::new (
static_cast<char*
>(data)) T(etl::forward<TArgs>(args)...);
1128 template <
typename T,
typename U>
1129 void do_construct(U&& value)
1134 template <
typename T,
typename U>
1142 ::new (
static_cast<void*
>(
etl::addressof(private_variant::variadic_union_get<index_of_type<T>::value>(data)))) T(etl::forward<U>(value));
1145 template <
typename T,
typename U>
1149 ::new (
static_cast<char*
>(data)) T(etl::forward<U>(value));
1158 memcpy(
static_cast<void*
>(&data),
static_cast<const void*
>(&other.data),
sizeof(data));
1164 private_variant::variant_operations<0, TTypes...>::copy(data, other.data, other.type_id);
1173 memcpy(
static_cast<void*
>(&data),
static_cast<const void*
>(&other.data),
sizeof(data));
1179 private_variant::variant_operations<0, TTypes...>::move(data, other.data, other.type_id);
1182 #if ETL_USING_CPP17 && !defined(ETL_VARIANT_FORCE_CPP11)
1186 template <
typename TVisitor,
size_t... I>
1187 void do_visitor(TVisitor& visitor, etl::index_sequence<I...>)
1189 (attempt_visitor<I>(visitor) || ...);
1195 template <
typename TVisitor,
size_t... I>
1196 void do_visitor(TVisitor& visitor, etl::index_sequence<I...>)
const
1198 (attempt_visitor<I>(visitor) || ...);
1204 template <
size_t NTypes,
typename TVisitor>
1205 void do_visitor(TVisitor& visitor)
1207 etl::private_variant::select_do_visitor<NTypes>::do_visitor(*
this, visitor);
1213 template <
size_t NTypes,
typename TVisitor>
1214 void do_visitor(TVisitor& visitor)
const
1216 etl::private_variant::select_do_visitor<NTypes>::do_visitor(*
this, visitor);
1223 template <
size_t Index,
typename TVisitor>
1224 bool attempt_visitor(TVisitor& visitor)
1226 if (Index == index())
1244 template <
size_t Index,
typename TVisitor>
1245 bool attempt_visitor(TVisitor& visitor)
const
1247 if (Index == index())
1262 #if ETL_USING_CPP17 && !defined(ETL_VARIANT_FORCE_CPP11)
1266 template <
typename TVisitor,
size_t... I>
1267 void do_operator(TVisitor& visitor, etl::index_sequence<I...>)
1269 (attempt_operator<I>(visitor) || ...);
1275 template <
typename TVisitor,
size_t... I>
1276 void do_operator(TVisitor& visitor, etl::index_sequence<I...>)
const
1278 (attempt_operator<I>(visitor) || ...);
1284 template <
size_t NTypes,
typename TVisitor>
1285 void do_operator(TVisitor& visitor)
1287 #if defined(ETL_VARIANT_CPP11_MAX_8_TYPES)
1288 ETL_STATIC_ASSERT(
sizeof...(TTypes) <= 8U,
"ETL_VARIANT_CPP11_MAX_8_TYPES - Only a maximum of 8 types are allowed in this variant");
1291 #if defined(ETL_VARIANT_CPP11_MAX_16_TYPES)
1292 ETL_STATIC_ASSERT(
sizeof...(TTypes) <= 16U,
"ETL_VARIANT_CPP11_MAX_16_TYPES - Only a maximum of 16 types are allowed in this variant");
1295 #if defined(ETL_VARIANT_CPP11_MAX_24_TYPES)
1296 ETL_STATIC_ASSERT(
sizeof...(TTypes) <= 24U,
"ETL_VARIANT_CPP11_MAX_24_TYPES - Only a maximum of 24 types are allowed in this variant");
1299 ETL_STATIC_ASSERT(
sizeof...(TTypes) <= 32U,
"A maximum of 32 types are allowed in this variant");
1301 etl::private_variant::select_do_operator<NTypes>::do_operator(*
this, visitor);
1307 template <
size_t NTypes,
typename TVisitor>
1308 void do_operator(TVisitor& visitor)
const
1310 #if defined(ETL_VARIANT_CPP11_MAX_8_TYPES)
1311 ETL_STATIC_ASSERT(
sizeof...(TTypes) <= 8U,
"ETL_VARIANT_CPP11_MAX_8_TYPES - Only a maximum of 8 types are allowed in this variant");
1314 #if defined(ETL_VARIANT_CPP11_MAX_16_TYPES)
1315 ETL_STATIC_ASSERT(
sizeof...(TTypes) <= 16U,
"ETL_VARIANT_CPP11_MAX_16_TYPES - Only a maximum of 16 types are allowed in this variant");
1318 #if defined(ETL_VARIANT_CPP11_MAX_24_TYPES)
1319 ETL_STATIC_ASSERT(
sizeof...(TTypes) <= 24U,
"ETL_VARIANT_CPP11_MAX_24_TYPES - Only a maximum of 24 types are allowed in this variant");
1322 ETL_STATIC_ASSERT(
sizeof...(TTypes) <= 32U,
"A maximum of 32 types are allowed in this variant");
1324 etl::private_variant::select_do_operator<NTypes>::do_operator(*
this, visitor);
1331 template <
size_t Index,
typename TVisitor>
1332 bool attempt_operator(TVisitor& visitor)
1334 if (Index == index())
1349 template <
size_t Index,
typename TVisitor>
1350 bool attempt_operator(TVisitor& visitor)
const
1352 if (Index == index())
1369 template <
size_t Index>
1370 ETL_CONSTEXPR14 type_from_index<Index>& get_value() ETL_NOEXCEPT
1375 template <
size_t Index>
1376 constexpr const type_from_index<Index>& get_value() const ETL_NOEXCEPT
1382 template <
size_t Index>
1385 return private_variant::variadic_union_get<Index>(data);
1388 template <
size_t Index>
1391 return private_variant::variadic_union_get<Index>(data);
1395 template <
size_t Index>
1398 return *
static_cast<type_from_index<Index>*
>(
data);
1401 template <
size_t Index>
1404 return *
static_cast<const type_from_index<Index>*
>(
data);
1410 template <
typename T>
1411 ETL_CONSTEXPR14 T* get_value_ptr() ETL_NOEXCEPT
1416 template <
typename T>
1417 constexpr const T* get_value_ptr() const ETL_NOEXCEPT
1423 template <
typename T>
1426 return &private_variant::variadic_union_get<index_of_type<T>::value>(
data);
1429 template <
typename T>
1432 return &private_variant::variadic_union_get<index_of_type<T>::value>(
data);
1436 template <
typename T>
1439 return static_cast<T*
>(
data);
1442 template <
typename T>
1445 return static_cast<const T*
>(
data);
1452 namespace private_variant
1458 template <
typename T,
typename T0,
typename T1,
typename... Ts>
1459 typename etl::enable_if_t<etl::is_same<T, T0>::value,
bool> ETL_CONSTEXPR14 is_same_type_in(
size_t index) ETL_NOEXCEPT;
1461 template <
typename T,
typename T0>
1462 typename etl::enable_if_t<etl::is_same<T, T0>::value,
bool> ETL_CONSTEXPR14 is_same_type_in(
size_t index) ETL_NOEXCEPT;
1464 template <
typename T,
typename T0,
typename T1,
typename... Ts>
1465 typename etl::enable_if_t<!etl::is_same<T, T0>::value,
bool> ETL_CONSTEXPR14 is_same_type_in(
size_t index) ETL_NOEXCEPT;
1467 template <
typename T,
typename T0>
1468 typename etl::enable_if_t<!etl::is_same<T, T0>::value,
bool> ETL_CONSTEXPR14 is_same_type_in(
size_t index) ETL_NOEXCEPT;
1470 template <
typename T,
typename T0,
typename T1,
typename... Ts>
1471 typename etl::enable_if_t<etl::is_same<T, T0>::value,
bool> ETL_CONSTEXPR14 is_same_type_in(
size_t index) ETL_NOEXCEPT
1479 return is_same_type_in<T, T1, Ts...>(index - 1);
1483 template <
typename T,
typename T0>
1484 typename etl::enable_if_t<etl::is_same<T, T0>::value,
bool> ETL_CONSTEXPR14 is_same_type_in(
size_t index) ETL_NOEXCEPT
1489 template <
typename T,
typename T0,
typename T1,
typename... Ts>
1490 typename etl::enable_if_t<!etl::is_same<T, T0>::value,
bool> ETL_CONSTEXPR14 is_same_type_in(
size_t index) ETL_NOEXCEPT
1498 return is_same_type_in<T, T1, Ts...>(index - 1);
1502 template <
typename T,
typename T0>
1503 typename etl::enable_if_t<!etl::is_same<T, T0>::value,
bool> ETL_CONSTEXPR14 is_same_type_in(
size_t) ETL_NOEXCEPT
1512 template <
typename T,
typename... TTypes>
1515 return private_variant::is_same_type_in<T, TTypes...>(v.index());
1521 template <
size_t Index,
typename... TTypes>
1524 return (Index == v.index());
1530 template <
typename... TTypes>
1533 return (index == v.index());
1539 template <
size_t Index,
typename... TTypes>
1542 #if ETL_USING_CPP17 && !defined(ETL_VARIANT_FORCE_CPP11)
1543 static_assert(Index <
sizeof...(TTypes),
"Index out of range");
1548 return v.template get_value<Index>();
1552 template <
size_t Index,
typename... TTypes>
1555 #if ETL_USING_CPP17 && !defined(ETL_VARIANT_FORCE_CPP11)
1556 static_assert(Index <
sizeof...(TTypes),
"Index out of range");
1561 return etl::move(v.template get_value<Index>());
1565 template <
size_t Index,
typename... TTypes>
1568 #if ETL_USING_CPP17 && !defined(ETL_VARIANT_FORCE_CPP11)
1569 static_assert(Index <
sizeof...(TTypes),
"Index out of range");
1574 return v.template get_value<Index>();
1578 template <
size_t Index,
typename... TTypes>
1581 #if ETL_USING_CPP17 & !defined(ETL_VARIANT_FORCE_CPP11)
1582 static_assert(Index <
sizeof...(TTypes),
"Index out of range");
1587 return etl::move(v.template get_value<Index>());
1591 template <
typename T,
typename... TTypes>
1596 return *v.template get_value_ptr<T>();
1600 template <
typename T,
typename... TTypes>
1605 return etl::move(*v.template get_value_ptr<T>());
1609 template <
typename T,
typename... TTypes>
1614 return *v.template get_value_ptr<T>();
1618 template <
typename T,
typename... TTypes>
1623 return etl::move(*v.template get_value_ptr<T>());
1629 template <
size_t Index,
typename... TTypes >
1632 if ((pv !=
nullptr) && (pv->index() == Index))
1643 template <
size_t Index,
typename... TTypes >
1647 if ((pv !=
nullptr) && (pv->index() == Index))
1658 template <
class T,
typename... TTypes >
1661 if ((pv !=
nullptr) && (private_variant::is_same_type_in<T, TTypes...>(pv->index())))
1663 return pv->template get_value_ptr<T>();
1672 template <
typename T,
typename... TTypes >
1675 if ((pv !=
nullptr) && (private_variant::is_same_type_in<T, TTypes...>(pv->index())))
1677 return pv->template get_value_ptr<T>();
1688 template <
typename... TTypes>
1697 template <
typename T>
1698 struct variant_size;
1700 template <
typename... TTypes>
1705 template <
typename T>
1711 template <
typename... TTypes>
1712 inline constexpr size_t variant_size_v = variant_size<TTypes...>::value;
1718 namespace private_variant
1720 template <
typename TRet,
typename TCallable,
typename TVariant,
size_t tIndex,
typename TNext,
typename... TVariants>
1721 static ETL_CONSTEXPR14 TRet do_visit_single(TCallable&& f, TVariant&& v, TNext&&, TVariants&&... vs);
1728 struct visit_auto_return
1736 template <
typename TCallable,
typename... Ts>
1737 struct single_visit_result_type
1739 using type =
decltype(declval<TCallable>()(declval<Ts>()...));
1742 template <
typename TCallable,
typename... Ts>
1743 using single_visit_result_type_t =
typename single_visit_result_type<TCallable, Ts...>::type;
1749 template <
typename TVar,
typename T>
1750 using rlref_copy = conditional_t<is_reference<TVar>::value, T&, T&&>;
1760 template <
template <
typename...>
class,
typename...>
1761 struct visit_result_helper;
1763 template <
template <
typename...>
class TToInject,
size_t... tAltIndices,
typename TCur>
1764 struct visit_result_helper<TToInject, index_sequence<tAltIndices...>, TCur>
1766 template <
size_t tIndex>
1767 using var_type = rlref_copy<TCur, variant_alternative_t<tIndex, remove_reference_t<TCur> > >;
1769 using type = common_type_t<TToInject<var_type<tAltIndices> >...>;
1772 template <
template <
typename...>
class TToInject,
size_t... tAltIndices,
typename TCur,
typename TNext,
typename... TVs>
1773 struct visit_result_helper<TToInject, index_sequence<tAltIndices...>, TCur, TNext, TVs...>
1775 template <
size_t tIndex>
1776 using var_type = rlref_copy<TCur, variant_alternative_t<tIndex, remove_reference_t<TCur> > >;
1778 template <
size_t tIndex>
1779 struct next_inject_wrap
1781 template <
typename... TNextInj>
1782 using next_inject = TToInject<var_type<tIndex>, TNextInj...>;
1783 using recursive_result =
1784 typename visit_result_helper<next_inject, make_index_sequence<variant_size<remove_reference_t<TNext> >::value>, TNext, TVs...>::type;
1787 using type = common_type_t<typename next_inject_wrap<tAltIndices>::recursive_result...>;
1795 template <
typename TRet,
typename...>
1801 template <
typename TCallable,
typename T1,
typename... Ts>
1802 struct visit_result<visit_auto_return, TCallable, T1, Ts...>
1805 template <
typename... Ts2>
1806 using single_res = single_visit_result_type_t<TCallable, Ts2...>;
1807 using type =
typename visit_result_helper<single_res, make_index_sequence<variant_size<remove_reference_t<T1> >::value>, T1, Ts...>::type;
1810 template <
typename... Ts>
1811 using visit_result_t =
typename visit_result<Ts...>::type;
1817 template <
typename TRet,
typename TCallable,
typename TVariant,
size_t tIndex>
1818 constexpr TRet do_visit_single(TCallable&& f, TVariant&& v)
1820 return static_cast<TCallable&&
>(f)(
etl::get<tIndex>(
static_cast<TVariant&&
>(v)));
1828 template <
typename TRet,
typename TCallable,
typename TCurVariant,
typename... TVarRest>
1829 struct do_visit_helper
1831 using function_pointer = add_pointer_t<TRet(TCallable&&, TCurVariant&&, TVarRest&&...)>;
1833 template <
size_t tIndex>
1834 static constexpr function_pointer fptr() ETL_NOEXCEPT
1836 return &do_visit_single<TRet, TCallable, TCurVariant, tIndex, TVarRest...>;
1843 template <
typename TRet,
typename TCallable,
typename TVariant,
size_t... tIndices,
typename... TVarRest>
1844 static ETL_CONSTEXPR14 TRet do_visit(TCallable&& f, TVariant&& v, index_sequence<tIndices...>, TVarRest&&... variants)
1846 ETL_ASSERT(!v.valueless_by_exception(), ETL_ERROR(bad_variant_access));
1848 using helper_t = do_visit_helper<TRet, TCallable, TVariant, TVarRest...>;
1849 using func_ptr =
typename helper_t::function_pointer;
1851 constexpr func_ptr jmp_table[]{helper_t::template fptr<tIndices>()...};
1853 return jmp_table[v.
index()](
static_cast<TCallable&&
>(f),
static_cast<TVariant&&
>(v),
static_cast<TVarRest&&
>(variants)...);
1856 template <
typename TRet,
typename TCallable,
typename TVariant,
typename... TVs>
1857 static ETL_CONSTEXPR14 TRet visit(TCallable&& f, TVariant&& v, TVs&&... vs)
1859 constexpr size_t variants = etl::variant_size<typename remove_reference<TVariant>::type>::value;
1860 return private_variant::do_visit<TRet>(
static_cast<TCallable&&
>(f),
static_cast<TVariant&&
>(v), make_index_sequence<variants>{},
1861 static_cast<TVs&&
>(vs)...);
1868 template <
typename TRet,
typename TCallable,
typename TVariant,
size_t tIndex>
1869 class constexpr_visit_closure
1871 add_pointer_t<TCallable> callable_;
1872 add_pointer_t<TVariant> variant_;
1876 constexpr constexpr_visit_closure(TCallable&& c, TVariant&& v)
1882 template <
typename... Ts>
1883 ETL_CONSTEXPR14 TRet operator()(Ts&&... args)
const
1885 return static_cast<TCallable&&
>(*callable_)(get<tIndex>(
static_cast<TVariant&&
>(*variant_)),
static_cast<Ts&&
>(args)...);
1889 template <
typename TRet,
typename TCallable,
typename TVariant,
size_t tIndex,
typename TNext,
typename... TVariants>
1890 static ETL_CONSTEXPR14 TRet do_visit_single(TCallable&& f, TVariant&& v, TNext&& next, TVariants&&... vs)
1892 return private_variant::visit<TRet>(
1893 constexpr_visit_closure<TRet, TCallable, TVariant, tIndex>(
static_cast<TCallable&&
>(f),
static_cast<TVariant&&
>(v)),
1894 static_cast<TNext&&
>(next),
static_cast<TVariants&&
>(vs)...);
1903 template <
typename TRet = private_variant::visit_auto_return,
typename... TVariants,
typename TCallable,
1904 typename TDeducedReturn = private_variant::visit_result_t<TRet, TCallable, TVariants...> >
1905 static ETL_CONSTEXPR14 TDeducedReturn visit(TCallable&& f, TVariants&&... vs)
1907 return private_variant::visit<TDeducedReturn>(
static_cast<TCallable&&
>(f),
static_cast<TVariants&&
>(vs)...);
1910 namespace private_variant
1916 template <
typename TVariant>
1917 struct equality_visitor
1919 equality_visitor(
const TVariant& rhs_)
1924 template <
typename TValue>
1925 bool operator()(
const TValue& lhs_downcasted)
1930 const TVariant& rhs;
1937 template <
typename TVariant>
1938 struct less_than_visitor
1940 less_than_visitor(
const TVariant& rhs_)
1945 template <
typename TValue>
1946 bool operator()(
const TValue& lhs_downcasted)
1948 return lhs_downcasted < etl::get<TValue>(rhs);
1951 const TVariant& rhs;
1959 template <
typename... TTypes>
1963 if (lhs.valueless_by_exception() && rhs.valueless_by_exception())
1969 if (lhs.valueless_by_exception() || rhs.valueless_by_exception())
1981 private_variant::equality_visitor<
etl::variant<TTypes...> > visitor(rhs);
1983 return etl::visit(visitor, lhs);
1990 template <
typename... TTypes>
1993 return !(lhs == rhs);
2000 template <
typename... TTypes>
2004 if (lhs.valueless_by_exception() && rhs.valueless_by_exception())
2010 if (lhs.valueless_by_exception())
2016 if (rhs.valueless_by_exception())
2028 private_variant::less_than_visitor<
etl::variant<TTypes...> > visitor(rhs);
2030 return etl::visit(visitor, lhs);
2037 template <
typename... TTypes>
2047 template <
typename... TTypes>
2050 return !(lhs > rhs);
2057 template <
typename... TTypes>
2060 return !(lhs < rhs);
2063 namespace private_variant
2065 #if ETL_USING_CPP20 && ETL_USING_STL && !(defined(ETL_DEVELOPMENT_OS_APPLE) && defined(ETL_COMPILER_CLANG))
2070 template <
typename TVariant>
2071 struct compare_visitor
2073 compare_visitor(
const TVariant& rhs_)
2078 template <
typename TValue>
2079 std::strong_ordering operator()(
const TValue& lhs_downcasted)
2084 const TVariant& rhs;
2094 #if ETL_USING_CPP20 && ETL_USING_STL && !(defined(ETL_DEVELOPMENT_OS_APPLE) && defined(ETL_COMPILER_CLANG))
2095 template <
typename... TTypes>
2096 ETL_CONSTEXPR14 std::common_comparison_category_t<std::compare_three_way_result_t<TTypes>...> operator<=>(
const etl::variant<TTypes...>& lhs,
2099 if (lhs.valueless_by_exception() && rhs.valueless_by_exception())
2101 return std::strong_ordering::equal;
2103 else if (lhs.valueless_by_exception())
2105 return std::strong_ordering::less;
2107 else if (rhs.valueless_by_exception())
2109 return std::strong_ordering::greater;
2118 private_variant::compare_visitor<
etl::variant<TTypes...> > visitor(rhs);
2120 return etl::visit(visitor, lhs);
2127 template <
typename TList>
2128 struct variant_from_type_list;
2130 template <
typename... TTypes>
2131 struct variant_from_type_list<
etl::type_list<TTypes...> >
2133 using type = etl::variant<TTypes...>;
2136 template <
typename TTypeList>
2137 using variant_from_type_list_t =
typename variant_from_type_list<TTypeList>::type;
void swap(etl::array_view< T > &lhs, etl::array_view< T > &rhs) ETL_NOEXCEPT
Swaps the values.
Definition array_view.h:692
Make this a clone of the supplied priority queue.
#define ETL_ASSERT(b, e)
Definition error_handler.h:511
ETL_EXCEPTION_CONSTEXPR exception(string_type reason_, string_type, numeric_type)
Constructor.
Definition exception.h:81
Definition exception.h:59
ETL_CONSTEXPR17 etl::enable_if<!etl::is_same< T, etl::nullptr_t >::value, T >::type * addressof(T &t)
Definition addressof.h:52
T & get()
Definition variant_legacy.h:738
size_t index() const
Gets the index of the type currently stored or UNSUPPORTED_TYPE_ID.
Definition variant_legacy.h:718
Definition variant_legacy.h:115
Definition variant_legacy.h:146
Definition variant_legacy.h:87
Definition variant_legacy.h:101
etl::monostate monostate
Definition variant_legacy.h:80
ETL_CONSTEXPR14 bool operator==(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1078
ETL_CONSTEXPR TContainer::pointer data(TContainer &container)
Definition iterator.h:1470
bool operator>(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1130
integral_constant< bool, false > false_type
integral_constant specialisations
Definition type_traits.h:80
bool operator>=(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1144
ETL_CONSTEXPR14 bool operator!=(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1090
T & get(array< T, Size > &a)
Definition array.h:1158
bool operator<(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1103
bool operator<=(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1117
integral_constant
Definition type_traits.h:67
A 'no-value' placeholder.
Definition monostate.h:42
Definition variant_legacy.h:989
ETL_CONSTEXPR14 bool operator==(const etl::to_arithmetic_result< T > &lhs, const etl::to_arithmetic_result< T > &rhs)
Equality test for etl::to_arithmetic_result.
Definition to_arithmetic.h:903
ETL_CONSTEXPR14 bool operator!=(const etl::to_arithmetic_result< T > &lhs, const etl::to_arithmetic_result< T > &rhs)
Inequality test for etl::to_arithmetic_result.
Definition to_arithmetic.h:937