31#ifndef ETL_UTILITY_INCLUDED
32#define ETL_UTILITY_INCLUDED
40#if defined(ETL_IN_UNIT_TEST) || ETL_USING_STL
56 constexpr typename etl::remove_reference<T>::type&& move(
T&& t) ETL_NOEXCEPT
58 return static_cast<typename etl::remove_reference<T>::type&&
>(t);
63 constexpr T&&
forward(
typename etl::remove_reference<T>::type& t) ETL_NOEXCEPT
65 return static_cast<T&&
>(t);
69 constexpr T&&
forward(
typename etl::remove_reference<T>::type&& t) ETL_NOEXCEPT
72 return static_cast<T&&
>(t);
85 template <
typename T,
typename U>
97 template <
typename T,
typename U>
109 template <
typename T,
typename U>
121 template <
typename T,
typename U>
133 template <
typename T,
typename U>
140 template <
typename T>
141 ETL_CONSTEXPR
typename underlying_type<T>::type to_underlying(
T value) ETL_NOEXCEPT
143 return static_cast<typename underlying_type<T>::type
>(value);
148#if ETL_NOT_USING_STL && !defined(ETL_IN_UNIT_TEST)
151 template <
typename T>
152 ETL_CONSTEXPR14
void swap(
T& a,
T&
b) ETL_NOEXCEPT
159 template<
class T,
size_t N >
160 ETL_CONSTEXPR14
void swap(
T(&a)[
N],
T(&
b)[
N]) ETL_NOEXCEPT
162 for (
size_t i = 0
UL; i <
N; ++i)
174 template <
typename T1,
typename T2>
209 template <
typename U1,
typename U2>
222 template <
typename U1,
typename U2>
238 template <
typename U1,
typename U2>
246#if defined(ETL_IN_UNIT_TEST) || ETL_USING_STL
248 template <
typename U1,
typename U2>
249 operator std::pair<U1, U2>()
255 template <
typename U1,
typename U2>
264 template <
typename U1,
typename U2>
275 using ETL_OR_STD::swap;
289 template <
typename U1,
typename U2>
307 template <
typename U1,
typename U2>
327 template <
typename T1,
typename T2>
333 template <
typename T1,
typename T2>
342 template <
size_t Index,
typename T1,
typename T2>
345 ETL_STATIC_ASSERT(
Index < 2U,
"pair has only 2 elements");
348 template <
typename T1,
typename T2>
354 template <
typename T1,
typename T2>
361 template <
typename T1,
typename T2>
368 template <
typename T1,
typename T2>
375 template <
typename T1,
typename T2>
384 template <
typename T1,
typename T2>
390 template <
typename T1,
typename T2>
393 return (a.first <
b.first) ||
394 (!(
b.first < a.first) && (a.second <
b.second));
398 template <
typename T1,
typename T2>
405 template <
typename T1,
typename T2>
412 template <
typename T1,
typename T2>
430 template <
typename TPair>
433 typedef typename TPair::first_type
type;
465 template <
typename TPair>
468 typedef typename TPair::second_type
type;
488#if ETL_NOT_USING_STL || ETL_CPP14_NOT_SUPPORTED
492 template <
typename T>
500 template <
typename T,
typename U>
511 template <
typename T,
typename U = T>
521 template <
typename T>
538 typedef T value_type;
540 static ETL_CONSTEXPR
size_t size() ETL_NOEXCEPT
542 return sizeof...(Integers);
548 template <
size_t N,
typename IndexSeq>
551 template <
size_t N,
size_t...
Indices>
554 using type =
typename make_index_sequence<N - 1,
etl::integer_sequence<size_t, N - 1, Indices...>>::type;
566 using make_index_sequence =
typename private_integer_sequence::make_index_sequence<N, etl::integer_sequence<size_t>>::type;
568 template <
typename...
TTypes>
575 template <
typename...
TTypes>
582 template <
typename T>
632 template <
typename T>
662 constexpr functor(TReturn(*ptr_)(TParams...))
670 constexpr TReturn operator()(TParams... args)
const
678 TReturn(*ptr)(TParams...);
687 template <
typename T>
695 template <
typename T, T& Instance, TReturn(T::* Method)(TParams...)>
696 static constexpr TReturn function(TParams... params)
708 template <
typename T>
716 template <
typename TFunctor, TFunctor& Instance>
729 template <auto& Instance>
732 template <
typename...
TArgs>
733 static constexpr auto call(
TArgs&&...
args)
743 template <auto Method, auto& Instance>
746 template <
typename...
TArgs>
747 static constexpr auto call(
TArgs&&...
args)
757 template <auto Method, auto& Instance>
762 template <
typename...
TArgs>
773 template <auto Function>
778 template<
typename...
TArgs>
791 template <
typename T>
integral_constant
Definition type_traits_generator.h:871
is_integral
Definition type_traits_generator.h:1040
is_lvalue_reference
Definition type_traits_generator.h:1160
bitset_ext
Definition absolute.h:38
pair< T1, T2 > make_pair(T1 a, T2 b)
A convenience wrapper for creating a pair from two objects.
Definition utility.h:334
T exchange(T &object, const T &new_value)
exchange (const)
Definition utility.h:493
bool operator>(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1148
bool operator>=(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1160
bool operator!=(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1109
void swap(etl::array< T, SIZE > &lhs, etl::array< T, SIZE > &rhs)
Template deduction guides.
Definition array.h:1085
ETL_CONSTEXPR TContainer::size_type size(const TContainer &container)
Definition iterator.h:1187
bool operator==(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1097
ETL_NODISCARD ETL_CONSTEXPR14 T round_half_even_unscaled(T value) ETL_NOEXCEPT
Definition scaled_rounding.h:314
etl::add_const< T >::type & as_const(T &t)
as_const
Definition utility.h:522
bool operator<(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1121
bool operator<=(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1136
integer_sequence
Definition utility.h:584
in_place disambiguation tags.
Definition utility.h:617
pair holds two objects of arbitrary type
Definition utility.h:176
T1 first_type
first_type is the first bound type
Definition utility.h:177
pair(const std::pair< U1, U2 > &other)
Constructing from std::pair.
Definition utility.h:256
T1 first
first is a copy of the first object
Definition utility.h:180
ETL_CONSTEXPR pair()
Default constructor.
Definition utility.h:188
ETL_CONSTEXPR14 pair(const T1 &a, const T2 &b)
Constructor from parameters.
Definition utility.h:199
operator std::pair< U1, U2 >()
Converting to std::pair.
Definition utility.h:249
ETL_CONSTEXPR14 pair(const pair< U1, U2 > &other)
Copy constructor.
Definition utility.h:223
pair(const pair< T1, T2 > &other)
Copy constructor.
Definition utility.h:230
T2 second
second is a copy of the second object
Definition utility.h:181
T2 second_type
second_type is the second bound type
Definition utility.h:178
Functor to select pair::first.
Definition utility.h:432
type & operator()(TPair &p) const
Function call that return p.first.
Definition utility.h:439
const type & operator()(const TPair &p) const
Function call that return p.first.
Definition utility.h:447
TPair::first_type type
type of member pair::first.
Definition utility.h:433
Functor to select pair::second.
Definition utility.h:467
type & operator()(TPair &p) const
Function call. The return value is p.second.
Definition utility.h:474
const type & operator()(const TPair &p) const
Function call. The return value is p.second.
Definition utility.h:482
TPair::second_type type
type of member pair::second.
Definition utility.h:468