Update templates for pentential macro name conflicts

This commit is contained in:
John Wellbelove 2025-07-26 13:23:02 +01:00
parent 5df08645da
commit 05e45117ea
34 changed files with 617 additions and 617 deletions

View File

@ -1164,32 +1164,32 @@ namespace etl
//*************************************************************************
/// Gets a reference to an element in the array.
///\tparam I The index.
///\tparam Index The index.
///\tparam T The type.
///\tparam MAXN The array size.
///\tparam Size The array size.
///\param a The array.
///\return A reference to the element
//*************************************************************************
template <size_t I, typename T, size_t MAXN>
inline T& get(array<T, MAXN>& a)
template <size_t Index, typename T, size_t Size>
inline T& get(array<T, Size>& a)
{
ETL_STATIC_ASSERT(I < MAXN, "Index out of bounds");
return a[I];
ETL_STATIC_ASSERT(Index < Size, "Index out of bounds");
return a[Index];
}
//*************************************************************************
/// Gets a const reference to an element in the array.
///\tparam I The index.
///\tparam Index The index.
///\tparam T The type.
///\tparam MAXN The array size.
///\tparam Size The array size.
///\param a The array.
///\return A const reference to the element
//*************************************************************************
template <size_t I, typename T, size_t MAXN>
inline const T& get(const array<T, MAXN>& a)
template <size_t Index, typename T, size_t Size>
inline const T& get(const array<T, Size>& a)
{
ETL_STATIC_ASSERT(I < MAXN, "Index out of bounds");
return a[I];
ETL_STATIC_ASSERT(Index < Size, "Index out of bounds");
return a[Index];
}
}

View File

@ -133,8 +133,8 @@ namespace etl
//*************************************************************************
/// Construct from etl::array.
//*************************************************************************
template <typename U, size_t N, typename = typename etl::enable_if<etl::is_same<etl::remove_cv_t<T>, etl::remove_cv_t<U>>::value, void>::type>
ETL_CONSTEXPR array_view(etl::array<U, N>& a) ETL_NOEXCEPT
template <typename U, size_t Size, typename = typename etl::enable_if<etl::is_same<etl::remove_cv_t<T>, etl::remove_cv_t<U>>::value, void>::type>
ETL_CONSTEXPR array_view(etl::array<U, Size>& a) ETL_NOEXCEPT
: mbegin(a.data())
, mend(a.data() + a.size())
{
@ -143,8 +143,8 @@ namespace etl
//*************************************************************************
/// Construct from etl::array.
//*************************************************************************
template <typename U, size_t N, typename = typename etl::enable_if<etl::is_same<etl::remove_cv_t<T>, etl::remove_cv_t<U>>::value, void>::type>
ETL_CONSTEXPR array_view(const etl::array<U, N>& a) ETL_NOEXCEPT
template <typename U, size_t Size, typename = typename etl::enable_if<etl::is_same<etl::remove_cv_t<T>, etl::remove_cv_t<U>>::value, void>::type>
ETL_CONSTEXPR array_view(const etl::array<U, Size>& a) ETL_NOEXCEPT
: mbegin(a.data())
, mend(a.data() + a.size())
{
@ -153,8 +153,8 @@ namespace etl
//*************************************************************************
/// Construct from etl::array.
//*************************************************************************
template <typename U, size_t N>
ETL_CONSTEXPR array_view(etl::array<U, N>& a, typename etl::enable_if<etl::is_same<typename etl::remove_cv<T>::type, typename etl::remove_cv<U>::type>::value, void>::type* = 0) ETL_NOEXCEPT
template <typename U, size_t Size>
ETL_CONSTEXPR array_view(etl::array<U, Size>& a, typename etl::enable_if<etl::is_same<typename etl::remove_cv<T>::type, typename etl::remove_cv<U>::type>::value, void>::type* = 0) ETL_NOEXCEPT
: mbegin(a.data())
, mend(a.data() + a.size())
{
@ -163,8 +163,8 @@ namespace etl
//*************************************************************************
/// Construct from etl::array.
//*************************************************************************
template <typename U, size_t N>
ETL_CONSTEXPR array_view(const etl::array<U, N>& a, typename etl::enable_if<etl::is_same<typename etl::remove_cv<T>::type, typename etl::remove_cv<U>::type>::value, void>::type* = 0) ETL_NOEXCEPT
template <typename U, size_t Size>
ETL_CONSTEXPR array_view(const etl::array<U, Size>& a, typename etl::enable_if<etl::is_same<typename etl::remove_cv<T>::type, typename etl::remove_cv<U>::type>::value, void>::type* = 0) ETL_NOEXCEPT
: mbegin(a.data())
, mend(a.data() + a.size())
{
@ -175,8 +175,8 @@ namespace etl
//*************************************************************************
/// Construct from std::array.
//*************************************************************************
template <typename U, size_t N, typename = typename etl::enable_if<etl::is_same<etl::remove_cv_t<T>, etl::remove_cv_t<U>>::value, void>::type>
ETL_CONSTEXPR array_view(std::array<U, N>& a) ETL_NOEXCEPT
template <typename U, size_t Size, typename = typename etl::enable_if<etl::is_same<etl::remove_cv_t<T>, etl::remove_cv_t<U>>::value, void>::type>
ETL_CONSTEXPR array_view(std::array<U, Size>& a) ETL_NOEXCEPT
: mbegin(a.data())
, mend(a.data() + a.size())
{
@ -185,8 +185,8 @@ namespace etl
//*************************************************************************
/// Construct from std::array.
//*************************************************************************
template <typename U, size_t N, typename = typename etl::enable_if<etl::is_same<etl::remove_cv_t<T>, etl::remove_cv_t<U>>::value, void>::type>
ETL_CONSTEXPR array_view(const std::array<U, N>& a) ETL_NOEXCEPT
template <typename U, size_t Size, typename = typename etl::enable_if<etl::is_same<etl::remove_cv_t<T>, etl::remove_cv_t<U>>::value, void>::type>
ETL_CONSTEXPR array_view(const std::array<U, Size>& a) ETL_NOEXCEPT
: mbegin(a.data())
, mend(a.data() + a.size())
{

View File

@ -85,15 +85,15 @@ namespace etl
/// Maximum value that can be contained in N bits.
///\ingroup binary
//***************************************************************************
/// Definition for non-zero NBITS.
template <size_t NBITS>
/// Definition for non-zero NBits.
template <size_t NBits>
struct max_value_for_nbits
{
typedef typename etl::smallest_uint_for_bits<NBITS>::type value_type;
static ETL_CONSTANT value_type value = (value_type(1) << (NBITS - 1)) | max_value_for_nbits<NBITS - 1>::value;
typedef typename etl::smallest_uint_for_bits<NBits>::type value_type;
static ETL_CONSTANT value_type value = (value_type(1) << (NBits - 1)) | max_value_for_nbits<NBits - 1>::value;
};
/// Specialisation for when NBITS == 0.
/// Specialisation for when NBits == 0.
template <>
struct max_value_for_nbits<0>
{
@ -101,12 +101,12 @@ namespace etl
static ETL_CONSTANT value_type value = 0;
};
template <size_t NBITS>
ETL_CONSTANT typename max_value_for_nbits<NBITS>::value_type max_value_for_nbits<NBITS>::value;
template <size_t NBits>
ETL_CONSTANT typename max_value_for_nbits<NBits>::value_type max_value_for_nbits<NBits>::value;
#if ETL_USING_CPP17
template <size_t NBITS>
inline constexpr typename etl::max_value_for_nbits<NBITS>::value_type max_value_for_nbits_v = max_value_for_nbits<NBITS>::value;
template <size_t NBits>
inline constexpr typename etl::max_value_for_nbits<NBits>::value_type max_value_for_nbits_v = max_value_for_nbits<NBits>::value;
#endif
//***************************************************************************
@ -239,19 +239,19 @@ namespace etl
/// Fold a binary number down to a set number of bits using XOR.
///\ingroup binary
//***************************************************************************
template <typename TReturn, size_t NBITS, typename TValue>
template <typename TReturn, size_t NBits, typename TValue>
ETL_CONSTEXPR14 TReturn fold_bits(TValue value)
{
ETL_STATIC_ASSERT(integral_limits<TReturn>::bits >= NBITS, "Return type too small to hold result");
ETL_STATIC_ASSERT(integral_limits<TReturn>::bits >= NBits, "Return type too small to hold result");
ETL_CONSTANT TValue mask = etl::power<2, NBITS>::value - 1U;
ETL_CONSTANT size_t shift = NBITS;
ETL_CONSTANT TValue mask = etl::power<2, NBits>::value - 1U;
ETL_CONSTANT size_t shift = NBits;
// Fold the value down to fit the width.
TReturn folded_value = 0;
// Keep shifting down and XORing the lower bits.
while (value >= etl::max_value_for_nbits<NBITS>::value)
while (value >= etl::max_value_for_nbits<NBits>::value)
{
folded_value ^= value & mask;
value >>= shift;
@ -268,16 +268,16 @@ namespace etl
/// Converts an N bit binary number, where bit N-1 is the sign bit, to a signed integral type.
///\ingroup binary
//***************************************************************************
template <typename TReturn, size_t NBITS, typename TValue>
template <typename TReturn, size_t NBits, typename TValue>
ETL_CONSTEXPR14 TReturn sign_extend(TValue value)
{
ETL_STATIC_ASSERT(etl::is_integral<TValue>::value, "TValue not an integral type");
ETL_STATIC_ASSERT(etl::is_integral<TReturn>::value, "TReturn not an integral type");
ETL_STATIC_ASSERT(NBITS <= etl::integral_limits<TReturn>::bits, "NBITS too large for return type");
ETL_STATIC_ASSERT(NBits <= etl::integral_limits<TReturn>::bits, "NBits too large for return type");
struct S
{
signed value : NBITS;
signed value : NBits;
} s = {0};
return (s.value = value);
@ -289,17 +289,17 @@ namespace etl
/// is the right shift amount, to a signed integral type.
///\ingroup binary
//***************************************************************************
template <typename TReturn, size_t NBITS, size_t SHIFT, typename TValue>
template <typename TReturn, size_t NBits, size_t SHIFT, typename TValue>
ETL_CONSTEXPR14 TReturn sign_extend(TValue value)
{
ETL_STATIC_ASSERT(etl::is_integral<TValue>::value, "TValue not an integral type");
ETL_STATIC_ASSERT(etl::is_integral<TReturn>::value, "TReturn not an integral type");
ETL_STATIC_ASSERT(NBITS <= etl::integral_limits<TReturn>::bits, "NBITS too large for return type");
ETL_STATIC_ASSERT(NBits <= etl::integral_limits<TReturn>::bits, "NBits too large for return type");
ETL_STATIC_ASSERT(SHIFT <= etl::integral_limits<TReturn>::bits, "SHIFT too large");
struct S
{
signed value : NBITS;
signed value : NBits;
} s = {0};
return (s.value = (value >> SHIFT));
@ -311,15 +311,15 @@ namespace etl
///\ingroup binary
//***************************************************************************
template <typename TReturn, typename TValue>
ETL_CONSTEXPR14 TReturn sign_extend(TValue value, size_t NBITS)
ETL_CONSTEXPR14 TReturn sign_extend(TValue value, size_t NBits)
{
ETL_STATIC_ASSERT(etl::is_integral<TValue>::value, "TValue not an integral type");
ETL_STATIC_ASSERT(etl::is_integral<TReturn>::value, "TReturn not an integral type");
ETL_ASSERT((NBITS <= etl::integral_limits<TReturn>::bits), ETL_ERROR(binary_out_of_range));
ETL_ASSERT((NBits <= etl::integral_limits<TReturn>::bits), ETL_ERROR(binary_out_of_range));
TReturn mask = TReturn(1) << (NBITS - 1);
value = value & TValue((TValue(1) << NBITS) - 1);
TReturn mask = TReturn(1) << (NBits - 1);
value = value & TValue((TValue(1) << NBits) - 1);
return TReturn((value ^ mask) - mask);
}
@ -331,15 +331,15 @@ namespace etl
///\ingroup binary
//***************************************************************************
template <typename TReturn, typename TValue>
ETL_CONSTEXPR14 TReturn sign_extend(TValue value, size_t NBITS, size_t SHIFT)
ETL_CONSTEXPR14 TReturn sign_extend(TValue value, size_t NBits, size_t SHIFT)
{
ETL_STATIC_ASSERT(etl::is_integral<TValue>::value, "TValue not an integral type");
ETL_STATIC_ASSERT(etl::is_integral<TReturn>::value, "TReturn not an integral type");
ETL_ASSERT((NBITS <= etl::integral_limits<TReturn>::bits), ETL_ERROR(binary_out_of_range));
ETL_ASSERT((NBits <= etl::integral_limits<TReturn>::bits), ETL_ERROR(binary_out_of_range));
TReturn mask = TReturn(1) << (NBITS - 1);
value = (value >> SHIFT) & TValue((TValue(1) << NBITS) - 1);
TReturn mask = TReturn(1) << (NBits - 1);
value = (value >> SHIFT) & TValue((TValue(1) << NBits) - 1);
return TReturn((value ^ mask) - mask);
}
@ -388,7 +388,7 @@ namespace etl
/// Fills a value with a bit pattern. Partial compile time.
///\ingroup binary
//***************************************************************************
template <typename TResult, typename TValue, TValue N>
template <typename TResult, typename TValue, TValue Value>
ETL_CONSTEXPR TResult binary_fill()
{
ETL_STATIC_ASSERT(sizeof(TResult) >= sizeof(TValue), "Result must be at least as large as the fill value");
@ -396,7 +396,7 @@ namespace etl
typedef typename etl::make_unsigned<TResult>::type unsigned_r_t;
typedef typename etl::make_unsigned<TValue>::type unsigned_v_t;
return TResult(unsigned_v_t(N) * (unsigned_r_t(~unsigned_r_t(0U)) / unsigned_v_t(~unsigned_v_t(0U))));
return TResult(unsigned_v_t(Value) * (unsigned_r_t(~unsigned_r_t(0U)) / unsigned_v_t(~unsigned_v_t(0U))));
}
#if ETL_USING_8BIT_TYPES
@ -418,12 +418,12 @@ namespace etl
/// Detects the presence of zero bytes. Partial compile time.
///\ingroup binary
//***************************************************************************
template <typename TValue, TValue N>
template <typename TValue, TValue Value>
ETL_CONSTEXPR14 bool has_zero_byte()
{
typedef typename etl::make_unsigned<TValue>::type unsigned_t;
ETL_CONSTEXPR14 const unsigned_t mask = etl::binary_fill<unsigned_t, uint8_t>(0x7FU);
const unsigned_t temp = unsigned_t(~((((unsigned_t(N) & mask) + mask) | unsigned_t(N)) | mask));
const unsigned_t temp = unsigned_t(~((((unsigned_t(Value) & mask) + mask) | unsigned_t(Value)) | mask));
return (temp != 0U);
}
@ -439,13 +439,13 @@ namespace etl
}
//***************************************************************************
/// Detects the presence of a byte of value N. Partial compile time.
/// Detects the presence of a byte of value Value. Partial compile time.
///\ingroup binary
//***************************************************************************
template <typename TValue, TValue N>
template <typename TValue, TValue Value>
ETL_CONSTEXPR14 bool has_byte_n(TValue value)
{
return etl::has_zero_byte(TValue(value ^ etl::binary_fill<TValue, uint8_t>(N)));
return etl::has_zero_byte(TValue(value ^ etl::binary_fill<TValue, uint8_t>(Value)));
}
#endif

View File

@ -64,16 +64,16 @@ namespace etl
//*************************************************************************
/// Registers a callback for the specified id.
/// Compile time assert if the id is out of range.
/// \tparam ID The id of the callback.
/// \tparam Id The id of the callback.
/// \param callback Reference to the callback.
//*************************************************************************
template <size_t ID>
template <size_t Id>
void register_callback(etl::ifunction<size_t>& callback)
{
ETL_STATIC_ASSERT(ID < (OFFSET + RANGE), "Callback Id out of range");
ETL_STATIC_ASSERT(ID >= OFFSET, "Callback Id out of range");
ETL_STATIC_ASSERT(Id < (OFFSET + RANGE), "Callback Id out of range");
ETL_STATIC_ASSERT(Id >= OFFSET, "Callback Id out of range");
lookup[ID - OFFSET] = &callback;
lookup[Id - OFFSET] = &callback;
}
//*************************************************************************
@ -102,15 +102,15 @@ namespace etl
//*************************************************************************
/// Executes the callback function for the index.
/// Compile time assert if the id is out of range.
/// \tparam ID The id of the callback.
/// \tparam Id The id of the callback.
//*************************************************************************
template <size_t ID>
template <size_t Id>
void callback()
{
ETL_STATIC_ASSERT(ID < (OFFSET + RANGE), "Callback Id out of range");
ETL_STATIC_ASSERT(ID >= OFFSET, "Callback Id out of range");
ETL_STATIC_ASSERT(Id < (OFFSET + RANGE), "Callback Id out of range");
ETL_STATIC_ASSERT(Id >= OFFSET, "Callback Id out of range");
(*lookup[ID - OFFSET])(ID);
(*lookup[Id - OFFSET])(Id);
}
//*************************************************************************

View File

@ -45,18 +45,18 @@ namespace etl
///\ingroup combinations
/// Calculates combinations.
//***************************************************************************
template <size_t NV, size_t KV>
template <size_t Value, size_t KV>
struct combinations
{
static ETL_CONSTANT size_t value = etl::permutations<NV, KV>::value / etl::factorial<KV>::value;
static ETL_CONSTANT size_t value = etl::permutations<Value, KV>::value / etl::factorial<KV>::value;
};
template <size_t NV, size_t KV>
ETL_CONSTANT size_t combinations<NV, KV>::value;
template <size_t Value, size_t KV>
ETL_CONSTANT size_t combinations<Value, KV>::value;
#if ETL_USING_CPP17
template <size_t NV, size_t KV>
inline constexpr size_t combinations_v = combinations<NV, KV>::value;
template <size_t Value, size_t KV>
inline constexpr size_t combinations_v = combinations<Value, KV>::value;
#endif
}

View File

@ -580,11 +580,11 @@ namespace etl
/// Template deduction guides.
//*************************************************************************
#if ETL_USING_CPP17
template <typename TElements, size_t N>
const_map_ext(const etl::span<TElements, N>&) -> const_map_ext<typename TElements::first_type, typename TElements::second_type>;
template <typename TElements, size_t Size>
const_map_ext(const etl::span<TElements, Size>&) -> const_map_ext<typename TElements::first_type, typename TElements::second_type>;
template <typename TElements, size_t N>
const_map_ext(const TElements(&)[N]) -> const_map_ext<typename TElements::first_type, typename TElements::second_type>;
template <typename TElements, size_t Size>
const_map_ext(const TElements(&)[Size]) -> const_map_ext<typename TElements::first_type, typename TElements::second_type>;
#endif
//*************************************************************************

View File

@ -534,11 +534,11 @@ namespace etl
/// Template deduction guides.
//*************************************************************************
#if ETL_USING_CPP17
template <typename TElements, size_t N>
const_multimap_ext(const etl::span<TElements, N>&) -> const_multimap_ext<typename TElements::first_type, typename TElements::second_type>;
template <typename TElements, size_t Size>
const_multimap_ext(const etl::span<TElements, Size>&) -> const_multimap_ext<typename TElements::first_type, typename TElements::second_type>;
template <typename TElements, size_t N>
const_multimap_ext(const TElements(&)[N]) -> const_multimap_ext<typename TElements::first_type, typename TElements::second_type>;
template <typename TElements, size_t Size>
const_multimap_ext(const TElements(&)[Size]) -> const_multimap_ext<typename TElements::first_type, typename TElements::second_type>;
#endif
//*************************************************************************

View File

@ -485,11 +485,11 @@ namespace etl
/// Template deduction guides.
//*************************************************************************
#if ETL_USING_CPP17
template <typename TElements, size_t N>
const_multiset_ext(const etl::span<TElements, N>&) -> const_multiset_ext<TElements>;
template <typename TElements, size_t Size>
const_multiset_ext(const etl::span<TElements, Size>&) -> const_multiset_ext<TElements>;
template <typename TElements, size_t N>
const_multiset_ext(const TElements(&)[N]) -> const_multiset_ext<TElements>;
template <typename TElements, size_t Size>
const_multiset_ext(const TElements(&)[Size]) -> const_multiset_ext<TElements>;
#endif
//*************************************************************************

View File

@ -481,11 +481,11 @@ namespace etl
/// Template deduction guides.
//*************************************************************************
#if ETL_USING_CPP17
template <typename TElements, size_t N>
const_set_ext(const etl::span<TElements, N>&) -> const_set_ext<TElements>;
template <typename TElements, size_t Size>
const_set_ext(const etl::span<TElements, Size>&) -> const_set_ext<TElements>;
template <typename TElements, size_t N>
const_set_ext(const TElements(&)[N]) -> const_set_ext<TElements>;
template <typename TElements, size_t Size>
const_set_ext(const TElements(&)[Size]) -> const_set_ext<TElements>;
#endif
//*************************************************************************

View File

@ -199,7 +199,7 @@ namespace etl
deque_base(size_t max_size_, size_t buffer_size_)
: current_size(0)
, CAPACITY(max_size_)
, BUFFER_SIZE(buffer_size_)
, Buffer_Size(buffer_size_)
{
}
@ -212,7 +212,7 @@ namespace etl
size_type current_size; ///< The current number of elements in the deque.
const size_type CAPACITY; ///< The maximum number of elements in the deque.
const size_type BUFFER_SIZE; ///< The number of elements in the buffer.
const size_type Buffer_Size; ///< The number of elements in the buffer.
ETL_DECLARE_DEBUG_COUNT; ///< Internal debugging.
};
@ -276,7 +276,7 @@ namespace etl
//***************************************************
iterator& operator ++()
{
index = (static_cast<size_t>(index) == p_deque->BUFFER_SIZE - 1) ? 0 : index + 1;
index = (static_cast<size_t>(index) == p_deque->Buffer_Size - 1) ? 0 : index + 1;
return *this;
}
@ -285,7 +285,7 @@ namespace etl
iterator operator ++(int)
{
iterator previous(*this);
index = (static_cast<size_t>(index) == p_deque->BUFFER_SIZE - 1) ? 0 : index + 1;
index = (static_cast<size_t>(index) == p_deque->Buffer_Size - 1) ? 0 : index + 1;
return previous;
}
@ -296,7 +296,7 @@ namespace etl
if (offset > 0)
{
index += offset;
index = (static_cast<size_t>(index) > p_deque->BUFFER_SIZE - 1) ? index - p_deque->BUFFER_SIZE : index;
index = (static_cast<size_t>(index) > p_deque->Buffer_Size - 1) ? index - p_deque->Buffer_Size : index;
}
else if (offset < 0)
{
@ -312,7 +312,7 @@ namespace etl
if (offset > 0)
{
index -= offset;
index = (index < 0) ? index + p_deque->BUFFER_SIZE : index;
index = (index < 0) ? index + p_deque->Buffer_Size : index;
}
else if (offset < 0)
{
@ -325,7 +325,7 @@ namespace etl
//***************************************************
iterator& operator --()
{
index = (index == 0) ? p_deque->BUFFER_SIZE - 1 : index - 1;
index = (index == 0) ? p_deque->Buffer_Size - 1 : index - 1;
return *this;
}
@ -334,7 +334,7 @@ namespace etl
iterator operator --(int)
{
iterator previous(*this);
index = (index == 0) ? p_deque->BUFFER_SIZE - 1 : index - 1;
index = (index == 0) ? p_deque->Buffer_Size - 1 : index - 1;
return previous;
}
@ -470,7 +470,7 @@ namespace etl
{
if (index_ < firstIndex)
{
return p_deque->BUFFER_SIZE + index_ - firstIndex;
return p_deque->Buffer_Size + index_ - firstIndex;
}
else
{
@ -546,7 +546,7 @@ namespace etl
//***************************************************
const_iterator& operator ++()
{
index = (static_cast<size_t>(index) == p_deque->BUFFER_SIZE - 1) ? 0 : index + 1;
index = (static_cast<size_t>(index) == p_deque->Buffer_Size - 1) ? 0 : index + 1;
return *this;
}
@ -555,7 +555,7 @@ namespace etl
const_iterator operator ++(int)
{
const_iterator previous(*this);
index = (static_cast<size_t>(index) == p_deque->BUFFER_SIZE - 1) ? 0 : index + 1;
index = (static_cast<size_t>(index) == p_deque->Buffer_Size - 1) ? 0 : index + 1;
return previous;
}
@ -566,7 +566,7 @@ namespace etl
if (offset > 0)
{
index += offset;
index = (static_cast<size_t>(index) > p_deque->BUFFER_SIZE - 1) ? index - p_deque->BUFFER_SIZE : index;
index = (static_cast<size_t>(index) > p_deque->Buffer_Size - 1) ? index - p_deque->Buffer_Size : index;
}
else if (offset < 0)
{
@ -582,7 +582,7 @@ namespace etl
if (offset > 0)
{
index -= offset;
index = (index < 0) ? static_cast<size_t>(index) + p_deque->BUFFER_SIZE : index;
index = (index < 0) ? static_cast<size_t>(index) + p_deque->Buffer_Size : index;
}
else if (offset < 0)
{
@ -595,7 +595,7 @@ namespace etl
//***************************************************
const_iterator& operator --()
{
index = (index == 0) ? p_deque->BUFFER_SIZE - 1 : index - 1;
index = (index == 0) ? p_deque->Buffer_Size - 1 : index - 1;
return *this;
}
@ -604,7 +604,7 @@ namespace etl
const_iterator operator --(int)
{
const_iterator previous(*this);
index = (index == 0) ? p_deque->BUFFER_SIZE - 1 : index - 1;
index = (index == 0) ? p_deque->Buffer_Size - 1 : index - 1;
return previous;
}
@ -729,7 +729,7 @@ namespace etl
{
if (index_ < firstIndex)
{
return p_deque->BUFFER_SIZE + index_ - firstIndex;
return p_deque->Buffer_Size + index_ - firstIndex;
}
else
{
@ -2324,7 +2324,7 @@ namespace etl
{
const difference_type index = other.get_index();
const difference_type reference_index = other.container()._begin.index;
const size_t buffer_size = other.container().BUFFER_SIZE;
const size_t buffer_size = other.container().Buffer_Size;
if (index < reference_index)
{
@ -2379,14 +2379,14 @@ namespace etl
private:
static ETL_CONSTANT size_t BUFFER_SIZE = MAX_SIZE + 1;
static ETL_CONSTANT size_t Buffer_Size = MAX_SIZE + 1;
public:
typedef T value_type;
typedef T* pointer;
typedef T* pointer;
typedef const T* const_pointer;
typedef T& reference;
typedef T& reference;
typedef const T& const_reference;
typedef size_t size_type;
typedef typename etl::iterator_traits<pointer>::difference_type difference_type;
@ -2395,7 +2395,7 @@ namespace etl
/// Default constructor.
//*************************************************************************
deque()
: etl::ideque<T>(reinterpret_cast<T*>(buffer.raw), MAX_SIZE, BUFFER_SIZE)
: etl::ideque<T>(reinterpret_cast<T*>(buffer.raw), MAX_SIZE, Buffer_Size)
{
this->initialise();
}
@ -2412,7 +2412,7 @@ namespace etl
/// Copy constructor.
//*************************************************************************
deque(const deque& other)
: etl::ideque<T>(reinterpret_cast<T*>(buffer.raw), MAX_SIZE, BUFFER_SIZE)
: etl::ideque<T>(reinterpret_cast<T*>(buffer.raw), MAX_SIZE, Buffer_Size)
{
if (this != &other)
{
@ -2425,7 +2425,7 @@ namespace etl
/// Move constructor.
//*************************************************************************
deque(deque&& other)
: etl::ideque<T>(reinterpret_cast<T*>(buffer.raw), MAX_SIZE, BUFFER_SIZE)
: etl::ideque<T>(reinterpret_cast<T*>(buffer.raw), MAX_SIZE, Buffer_Size)
{
if (this != &other)
{
@ -2446,7 +2446,7 @@ namespace etl
//*************************************************************************
template <typename TIterator>
deque(TIterator begin_, TIterator end_, typename etl::enable_if<!etl::is_integral<TIterator>::value, int>::type = 0)
: etl::ideque<T>(reinterpret_cast<T*>(buffer.raw), MAX_SIZE, BUFFER_SIZE)
: etl::ideque<T>(reinterpret_cast<T*>(buffer.raw), MAX_SIZE, Buffer_Size)
{
this->assign(begin_, end_);
}
@ -2455,7 +2455,7 @@ namespace etl
/// Assigns data to the deque.
//*************************************************************************
explicit deque(size_t n, const_reference value = value_type())
: etl::ideque<T>(reinterpret_cast<T*>(buffer.raw), MAX_SIZE, BUFFER_SIZE)
: etl::ideque<T>(reinterpret_cast<T*>(buffer.raw), MAX_SIZE, Buffer_Size)
{
this->assign(n, value);
}
@ -2465,7 +2465,7 @@ namespace etl
/// Construct from initializer_list.
//*************************************************************************
deque(std::initializer_list<T> init)
: ideque<T>(reinterpret_cast<T*>(buffer.raw), MAX_SIZE, BUFFER_SIZE)
: ideque<T>(reinterpret_cast<T*>(buffer.raw), MAX_SIZE, Buffer_Size)
{
this->assign(init.begin(), init.end());
}
@ -2524,7 +2524,7 @@ namespace etl
private:
/// The uninitialised buffer of T used in the deque.
etl::uninitialized_buffer_of<T, BUFFER_SIZE> buffer;
etl::uninitialized_buffer_of<T, Buffer_Size> buffer;
};
template <typename T, const size_t MAX_SIZE_>

View File

@ -263,7 +263,7 @@ namespace etl
typedef void(*assert_function_ptr_t)(const etl::exception&);
// Stores the assert function pointer and default assert function.
template <size_t N>
template <size_t Index>
struct assert_handler
{
static assert_function_ptr_t assert_function_ptr;
@ -274,8 +274,8 @@ namespace etl
}
};
template <size_t N>
assert_function_ptr_t assert_handler<N>::assert_function_ptr = assert_handler<N>::default_assert;
template <size_t Index>
assert_function_ptr_t assert_handler<Index>::assert_function_ptr = assert_handler<Index>::default_assert;
}
//***************************************************************************

View File

@ -36,7 +36,7 @@ SOFTWARE.
#include <stddef.h>
///\defgroup factorial factorial
/// fibonacci<N> : Calculates the Nth factorial value.
/// fibonacci<Value> : Calculates the factorial of Value.
///\ingroup maths
namespace etl
@ -44,16 +44,16 @@ namespace etl
//***************************************************************************
///\ingroup fibonacci
/// Defines <b>value</b> as the Nth factorial number.
///\tparam N The number to find the factorial value of.
///\tparam Value The number to find the factorial value of.
//***************************************************************************
template <size_t N>
template <size_t Value>
struct factorial
{
static ETL_CONSTANT size_t value = N * factorial<N - 1>::value;
static ETL_CONSTANT size_t value = Value * factorial<Value - 1>::value;
};
//***************************************************************************
// Specialisation for N = 0
// Specialisation for Value = 0
//***************************************************************************
template <>
struct factorial<0>
@ -61,12 +61,12 @@ namespace etl
static ETL_CONSTANT size_t value = 1;
};
template <size_t N>
ETL_CONSTANT size_t factorial<N>::value;
template <size_t Value>
ETL_CONSTANT size_t factorial<Value>::value;
#if ETL_USING_CPP17
template <size_t N>
inline constexpr size_t factorial_v = factorial<N>::value;
template <size_t Value>
inline constexpr size_t factorial_v = factorial<Value>::value;
#endif
}

View File

@ -36,7 +36,7 @@ SOFTWARE.
#include <stddef.h>
///\defgroup fibonacci fibonacci
/// fibonacci<N> : Calculates the Nth Fibonacci value.
/// fibonacci<Value> : Calculates the Nth Fibonacci value.
///\ingroup maths
namespace etl
@ -44,16 +44,16 @@ namespace etl
//***************************************************************************
///\ingroup fibonacci
/// Defines <b>value</b> as the Nth Fibonacci number.
///\tparam N The number to find the Fibonacci value of.
///\tparam Value The number to find the Fibonacci value of.
//***************************************************************************
template <size_t N>
template <size_t Value>
struct fibonacci
{
static ETL_CONSTANT size_t value = fibonacci<N - 1>::value + fibonacci<N - 2>::value;
static ETL_CONSTANT size_t value = fibonacci<Value - 1>::value + fibonacci<Value - 2>::value;
};
//***************************************************************************
// Specialisation for N = 1
// Specialisation for Value = 1
//***************************************************************************
template <>
struct fibonacci<1>
@ -62,7 +62,7 @@ namespace etl
};
//***************************************************************************
// Specialisation for N = 0
// Specialisation for Value = 0
//***************************************************************************
template <>
struct fibonacci<0>
@ -70,12 +70,12 @@ namespace etl
static ETL_CONSTANT size_t value = 0UL;
};
template <size_t N>
ETL_CONSTANT size_t fibonacci<N>::value;
template <size_t Value>
ETL_CONSTANT size_t fibonacci<Value>::value;
#if ETL_USING_CPP17
template <size_t N>
inline constexpr size_t fibonacci_v = fibonacci<N>::value;
template <size_t Value>
inline constexpr size_t fibonacci_v = fibonacci<Value>::value;
#endif
}

View File

@ -21,7 +21,7 @@ copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
FITNESS FOR Value1 PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
@ -41,16 +41,16 @@ namespace etl
// Greatest Common Divisor.
// Compile time.
//***************************************************************************
template <intmax_t A, intmax_t B>
template <intmax_t Value1, intmax_t Value2>
struct gcd_const
{
static ETL_CONSTANT intmax_t value = gcd_const<B, A % B>::value;
static ETL_CONSTANT intmax_t value = gcd_const<Value2, Value1 % Value2>::value;
};
template <intmax_t A>
struct gcd_const<A, 0>
template <intmax_t Value1>
struct gcd_const<Value1, 0>
{
static ETL_CONSTANT intmax_t value = A;
static ETL_CONSTANT intmax_t value = Value1;
};
//***************************************************************************

View File

@ -69,7 +69,7 @@ namespace etl
enum
{
ID = ID_
Id = ID_
};
};
@ -96,19 +96,19 @@ namespace etl
struct nulltype {};
// For N type pairs.
template <size_t ID, typename T1, typename... TRest>
template <size_t Id, typename T1, typename... TRest>
struct type_from_id_helper
{
using type = typename etl::conditional<ID == T1::ID,
using type = typename etl::conditional<Id == T1::Id,
typename T1::type,
typename type_from_id_helper<ID, TRest...>::type>::type;
typename type_from_id_helper<Id, TRest...>::type>::type;
};
// Specialisation for 1 type pair.
template <size_t ID, typename T1>
struct type_from_id_helper<ID, T1>
template <size_t Id, typename T1>
struct type_from_id_helper<Id, T1>
{
using type = typename etl::conditional<ID == T1::ID,
using type = typename etl::conditional<Id == T1::Id,
typename T1::type,
nulltype>::type;
};
@ -118,16 +118,16 @@ namespace etl
//************************************
// type_from_id
//************************************
template <int ID>
template <int Id>
struct type_from_id
{
using type = typename type_from_id_helper<ID, TTypes...>::type;
using type = typename type_from_id_helper<Id, TTypes...>::type;
static_assert(!(etl::is_same<nulltype, type>::value), "Invalid id");
};
template <int ID>
using type_from_id_t = typename type_from_id<ID>::type;
template <int Id>
using type_from_id_t = typename type_from_id<Id>::type;
private:
@ -137,14 +137,14 @@ namespace etl
template <typename T, typename T1, typename... TRest>
struct id_from_type_helper
{
static constexpr size_t value = etl::is_same<T, typename T1::type>::value ? size_t(T1::ID) : id_from_type_helper<T, TRest...>::value;
static constexpr size_t value = etl::is_same<T, typename T1::type>::value ? size_t(T1::Id) : id_from_type_helper<T, TRest...>::value;
};
// Specialisation for 1 type pair.
template <typename T, typename T1>
struct id_from_type_helper<T, T1>
{
static constexpr size_t value = etl::is_same<T, typename T1::type>::value ? size_t(T1::ID) : UNKNOWN;
static constexpr size_t value = etl::is_same<T, typename T1::type>::value ? size_t(T1::Id) : UNKNOWN;
};
public:
@ -241,12 +241,12 @@ namespace etl
cog.outl("public:")
cog.outl("")
cog.outl(" //************************************")
cog.outl(" template <int ID>")
cog.outl(" template <int Id>")
cog.outl(" struct type_from_id")
cog.outl(" {")
cog.outl(" typedef ")
for n in range(1, int(NTypes) + 1):
cog.outl(" typename etl::conditional<ID == T%s::ID, typename T%s::type," %(n, n))
cog.outl(" typename etl::conditional<Id == T%s::Id, typename T%s::type," %(n, n))
cog.out(" etl::null_type<0> >")
for n in range(1, int(NTypes) + 1):
if n == int(NTypes):
@ -274,7 +274,7 @@ namespace etl
cog.outl(" {")
cog.outl(" value =")
for n in range(1, int(NTypes) + 1) :
cog.outl(" (unsigned int) etl::is_same<T, typename T%s::type>::value ? (unsigned int)T%s::ID :" % (n, n))
cog.outl(" (unsigned int) etl::is_same<T, typename T%s::type>::value ? (unsigned int)T%s::Id :" % (n, n))
cog.outl(" (unsigned int) UNKNOWN")
cog.outl(" };")
cog.outl("")

View File

@ -66,40 +66,40 @@ namespace etl
private:
//***********************************
template <size_t ID, size_t N, typename T1, typename... TRest>
template <size_t Id, size_t Index, typename T1, typename... TRest>
struct type_select_helper
{
using type = typename etl::conditional<ID == N,
using type = typename etl::conditional<Id == Index,
T1,
typename type_select_helper<ID, N + 1, TRest...>::type>::type;
typename type_select_helper<Id, Index + 1, TRest...>::type>::type;
};
//***********************************
template <size_t ID, size_t N, typename T1>
struct type_select_helper<ID, N, T1>
template <size_t Id, size_t Index, typename T1>
struct type_select_helper<Id, Index, T1>
{
using type = T1;
};
public:
template <size_t ID>
template <size_t Id>
struct select
{
static_assert(ID < sizeof...(TTypes), "Illegal type_select::select index");
static_assert(Id < sizeof...(TTypes), "Illegal type_select::select index");
using type = typename type_select_helper<ID, 0, TTypes...>::type;
using type = typename type_select_helper<Id, 0, TTypes...>::type;
};
template <size_t ID>
using select_t = typename select<ID>::type;
template <size_t Id>
using select_t = typename select<Id>::type;
};
//***************************************************************************
// Select type alias
//***************************************************************************
template <size_t N, typename... TTypes>
using type_select_t = typename etl::type_select<TTypes...>:: template select_t<N>;
template <size_t Index, typename... TTypes>
using type_select_t = typename etl::type_select<TTypes...>:: template select_t<Index>;
#else
@ -116,12 +116,12 @@ namespace etl
cog.outl("{")
cog.outl("public:")
cog.outl("")
cog.outl(" template <size_t ID>")
cog.outl(" template <size_t Id>")
cog.outl(" struct select")
cog.outl(" {")
cog.outl(" typedef typename etl::conditional<ID == 0, T0,")
cog.outl(" typedef typename etl::conditional<Id == 0, T0,")
for n in range(1, int(NTypes)) :
cog.outl(" typename etl::conditional<ID == %s, T%s," % (n, n))
cog.outl(" typename etl::conditional<Id == %s, T%s," % (n, n))
cog.outl(" etl::null_type<0> >")
cog.out(" ")
for n in range(1, int(NTypes)) :
@ -131,7 +131,7 @@ namespace etl
cog.out(" ")
cog.outl("::type type;")
cog.outl("");
cog.outl(" ETL_STATIC_ASSERT(ID < %s, \"Invalid ID\");" % int(NTypes));
cog.outl(" ETL_STATIC_ASSERT(Id < %s, \"Invalid Id\");" % int(NTypes));
cog.outl(" };")
cog.outl("};")
@ -151,12 +151,12 @@ namespace etl
cog.outl("T%s>" % (s - 1))
cog.outl("{")
cog.outl("public:")
cog.outl(" template <size_t ID>")
cog.outl(" template <size_t Id>")
cog.outl(" struct select")
cog.outl(" {")
cog.outl(" typedef typename etl::conditional<ID == 0, T0,")
cog.outl(" typedef typename etl::conditional<Id == 0, T0,")
for n in range(1, s) :
cog.outl(" typename etl::conditional<ID == %s, T%s," % (n, n))
cog.outl(" typename etl::conditional<Id == %s, T%s," % (n, n))
cog.outl(" etl::null_type<0> >")
cog.out(" ")
for n in range(1, s) :
@ -166,7 +166,7 @@ namespace etl
cog.out(" ")
cog.outl("::type type;")
cog.outl("");
cog.outl(" ETL_STATIC_ASSERT(ID < %s, \"Invalid ID\");" % s);
cog.outl(" ETL_STATIC_ASSERT(Id < %s, \"Invalid Id\");" % s);
cog.outl(" };")
cog.outl("};")
]]]*/

View File

@ -599,8 +599,8 @@ namespace etl
struct extent<T[I], MAXN> : integral_constant<size_t, extent<T, MAXN - 1>::value> {};
#if ETL_USING_CPP17
template <typename T, unsigned N = 0U>
inline constexpr size_t extent_v = extent<T, N>::value;
template <typename T, unsigned MAXN = 0U>
inline constexpr size_t extent_v = extent<T, MAXN>::value;
#endif
//***************************************************************************
@ -1579,10 +1579,10 @@ typedef integral_constant<bool, true> true_type;
/// Requires that the class has defined 'base_type'.
//***************************************************************************
// Recursive definition of the type.
template <size_t N, typename TType>
template <size_t Index, typename TType>
struct nth_base
{
typedef typename nth_base<N - 1U, typename TType::base_type>::type type;
typedef typename nth_base<Index - 1U, typename TType::base_type>::type type;
};
template <typename TType>
@ -1592,8 +1592,8 @@ typedef integral_constant<bool, true> true_type;
};
#if ETL_USING_CPP11
template <size_t N, typename TType>
using nth_base_t = typename nth_base<N, TType>::type;
template <size_t Index, typename TType>
using nth_base_t = typename nth_base<Index, TType>::type;
#endif
//***************************************************************************

View File

@ -21,7 +21,7 @@ copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
FITNESS FOR Value1 PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
@ -42,10 +42,10 @@ namespace etl
// Least Common Multiple.
// Compile time.
//***************************************************************************
template <intmax_t A, intmax_t B>
template <intmax_t Value1, intmax_t Value2>
struct lcm_const
{
static ETL_CONSTANT intmax_t value = (A / gcd_const<A, B>::value) * B;
static ETL_CONSTANT intmax_t value = (Value1 / gcd_const<Value1, Value2>::value) * Value2;
};
//***************************************************************************

View File

@ -36,7 +36,7 @@ SOFTWARE.
#include <stddef.h>
///\defgroup log log
/// log<N, BASE> : Calculates logs to any base, rounded down to the nearest integer.<br>
/// log<N, Base> : Calculates logs to any base, rounded down to the nearest integer.<br>
/// log2<N> : Calculates logs to base 2, rounded down to the nearest integer.<br>
/// log10<N> : Calculates logs to base 10, rounded down to the nearest integer.<br>
///\ingroup maths
@ -48,24 +48,24 @@ namespace etl
/// The base generic log template.
/// Defines <b>value</b> as the log of the number at the specified base.
/// The result is rounded down to the next integer.
///\tparam NV The number to find the log of.
///\tparam BASE The base of the log.
///\tparam Value The number to find the log of.
///\tparam Base The base of the log.
//***************************************************************************
template <size_t NV, size_t BASE>
template <size_t Value, size_t Base>
struct log
{
enum value_type
{
// Recursive definition.
value = (NV >= BASE) ? 1 + log<NV / BASE, BASE>::value : 0
value = (Value >= Base) ? 1 + log<Value / Base, Base>::value : 0
};
};
//***************************************************************************
// Specialisation for N = 1
//***************************************************************************
template <size_t BASE>
struct log<1, BASE>
template <size_t Base>
struct log<1, Base>
{
enum value_type
{
@ -76,8 +76,8 @@ namespace etl
//***************************************************************************
// Specialisation for N = 0
//***************************************************************************
template <size_t BASE>
struct log<0, BASE>
template <size_t Base>
struct log<0, Base>
{
enum value_type
{
@ -86,44 +86,44 @@ namespace etl
};
#if ETL_USING_CPP17
template <size_t NV, size_t BASE>
inline constexpr size_t log_v = log<NV, BASE>::value;
template <size_t Value, size_t Base>
inline constexpr size_t log_v = log<Value, Base>::value;
#endif
//***************************************************************************
///\ingroup log
/// Calculates base 2 logs.
//***************************************************************************
template <size_t NV>
template <size_t Value>
struct log2
{
enum value_type
{
value = log<NV, 2>::value
value = log<Value, 2>::value
};
};
#if ETL_USING_CPP17
template <size_t NV>
inline constexpr size_t log2_v = log2<NV>::value;
template <size_t Value>
inline constexpr size_t log2_v = log2<Value>::value;
#endif
//***************************************************************************
///\ingroup log
/// Calculates base 10 logs.
//***************************************************************************
template <size_t NV>
template <size_t Value>
struct log10
{
enum value_type
{
value = log<NV, 10>::value
value = log<Value, 10>::value
};
};
#if ETL_USING_CPP17
template <size_t NV>
inline constexpr size_t log10_v = log10<NV>::value;
template <size_t Value>
inline constexpr size_t log10_v = log10<Value>::value;
#endif
}

View File

@ -38,10 +38,10 @@ namespace etl
namespace private_nth_type
{
//***********************************
template <size_t N, typename T1, typename... TRest>
template <size_t Index, typename T1, typename... TRest>
struct nth_type_helper
{
using type = typename nth_type_helper<N - 1U, TRest...>::type;
using type = typename nth_type_helper<Index - 1U, TRest...>::type;
};
template <typename T1, typename... TRest>
@ -52,17 +52,17 @@ namespace etl
}
//***********************************
template <size_t N, typename... TTypes>
template <size_t Index, typename... TTypes>
struct nth_type
{
ETL_STATIC_ASSERT(N < sizeof...(TTypes), "etl::nth_type index 'N' out of bounds");
ETL_STATIC_ASSERT(Index < sizeof...(TTypes), "etl::nth_type index 'Index' out of bounds");
using type = typename private_nth_type::nth_type_helper<N, TTypes...>::type;
using type = typename private_nth_type::nth_type_helper<Index, TTypes...>::type;
};
//***********************************
template <size_t N, typename... TTypes>
using nth_type_t = typename nth_type<N, TTypes...>::type;
template <size_t Index, typename... TTypes>
using nth_type_t = typename nth_type<Index, TTypes...>::type;
}
#endif
#endif

View File

@ -35,7 +35,7 @@ SOFTWARE.
namespace etl
{
template <size_t N>
template <size_t Index>
class null_type
{
};

View File

@ -89,36 +89,36 @@ namespace etl
//***************************************************************************
/// type_from_index
//***************************************************************************
template <size_t I>
template <size_t Index>
class type_from_index
{
private:
//***********************************
template <size_t II, size_t N, typename T1, typename... TRest>
template <size_t Desired_Index, size_t Current_Index, typename T1, typename... TRest>
struct type_from_index_helper
{
using type = typename etl::conditional<II == N, T1, typename type_from_index_helper<II, N + 1, TRest...>::type>::type;
using type = typename etl::conditional<Desired_Index == Current_Index, T1, typename type_from_index_helper<Desired_Index, Current_Index + 1, TRest...>::type>::type;
};
//***********************************
template <size_t II, size_t N, typename T1>
struct type_from_index_helper<II, N, T1>
template <size_t Desired_Index, size_t Current_Index, typename T1>
struct type_from_index_helper<Desired_Index, Current_Index, T1>
{
using type = T1;
};
public:
static_assert(I < sizeof...(TTypes), "Index out of bounds of parameter pack");
static_assert(Index < sizeof...(TTypes), "Index out of bounds of parameter pack");
/// Template alias
using type = typename type_from_index_helper<I, 0, TTypes...>::type;
using type = typename type_from_index_helper<Index, 0, TTypes...>::type;
};
//***********************************
template <size_t I>
using type_from_index_t = typename type_from_index<I>::type;
template <size_t Index>
using type_from_index_t = typename type_from_index<Index>::type;
};
//***********************************

View File

@ -43,31 +43,31 @@ namespace etl
///\ingroup permutations
/// Calculates permutations.
//***************************************************************************
template <size_t NV, size_t KV>
template <size_t Value, size_t KV>
struct permutations
{
static ETL_CONSTANT size_t value = NV * permutations<NV - 1, KV - 1>::value;
static ETL_CONSTANT size_t value = Value * permutations<Value - 1, KV - 1>::value;
};
template <size_t NV, size_t KV>
ETL_CONSTANT size_t permutations<NV, KV>::value;
template <size_t Value, size_t KV>
ETL_CONSTANT size_t permutations<Value, KV>::value;
//***************************************************************************
/// Calculates permutations.
/// Specialisation for KV == 0.
//***************************************************************************
template <size_t NV>
struct permutations<NV, 0>
template <size_t Value>
struct permutations<Value, 0>
{
static ETL_CONSTANT size_t value = 1UL;
};
template <size_t NV>
ETL_CONSTANT size_t permutations<NV, 0>::value;
template <size_t Value>
ETL_CONSTANT size_t permutations<Value, 0>::value;
#if ETL_USING_CPP17
template <size_t NV, size_t KV>
inline constexpr size_t permutations_v = permutations<NV, KV>::value;
template <size_t Value, size_t KV>
inline constexpr size_t permutations_v = permutations<Value, KV>::value;
#endif
}

View File

@ -311,36 +311,36 @@ namespace etl
//*************************************************************************
/// Construct from C array
//*************************************************************************
template<typename U, size_t N>
ETL_CONSTEXPR poly_span(U(&begin_)[N]) ETL_NOEXCEPT
template<typename U, size_t Size>
ETL_CONSTEXPR poly_span(U(&begin_)[Size]) ETL_NOEXCEPT
: pbegin(begin_)
, element_size(sizeof(U))
{
ETL_STATIC_ASSERT(N <= Extent, "Array data overflow");
ETL_STATIC_ASSERT(Size <= Extent, "Array data overflow");
ETL_STATIC_ASSERT((etl::is_base_of<TBase, U>::value || etl::is_same<TBase, U>::value), "TBase not a base of the data type");
}
//*************************************************************************
/// Construct from etl::array.
//*************************************************************************
template <typename U, size_t N>
ETL_CONSTEXPR poly_span(etl::array<U, N>& a) ETL_NOEXCEPT
template <typename U, size_t Size>
ETL_CONSTEXPR poly_span(etl::array<U, Size>& a) ETL_NOEXCEPT
: pbegin(a.data())
, element_size(sizeof(U))
{
ETL_STATIC_ASSERT(N <= Extent, "Array data overflow");
ETL_STATIC_ASSERT(Size <= Extent, "Array data overflow");
ETL_STATIC_ASSERT((etl::is_base_of<TBase, U>::value || etl::is_same<TBase, U>::value), "TBase not a base of the data type");
}
//*************************************************************************
/// Construct from etl::array.
//*************************************************************************
template <typename U, size_t N>
ETL_CONSTEXPR poly_span(const etl::array<U, N>& a) ETL_NOEXCEPT
template <typename U, size_t Size>
ETL_CONSTEXPR poly_span(const etl::array<U, Size>& a) ETL_NOEXCEPT
: pbegin(a.data())
, element_size(sizeof(U))
{
ETL_STATIC_ASSERT(N <= Extent, "Array data overflow");
ETL_STATIC_ASSERT(Size <= Extent, "Array data overflow");
ETL_STATIC_ASSERT((etl::is_base_of<TBase, U>::value || etl::is_same<TBase, U>::value), "TBase not a base of the data type");
}
@ -348,24 +348,24 @@ namespace etl
//*************************************************************************
/// Construct from std::array.
//*************************************************************************
template <typename U, size_t N>
ETL_CONSTEXPR poly_span(std::array<U, N>& a) ETL_NOEXCEPT
template <typename U, size_t Size>
ETL_CONSTEXPR poly_span(std::array<U, Size>& a) ETL_NOEXCEPT
: pbegin(a.data())
, element_size(sizeof(U))
{
ETL_STATIC_ASSERT(N <= Extent, "Array data overflow");
ETL_STATIC_ASSERT(Size <= Extent, "Array data overflow");
ETL_STATIC_ASSERT((etl::is_base_of<TBase, U>::value || etl::is_same<TBase, U>::value), "TBase not a base of U");
}
//*************************************************************************
/// Construct from std::array.
//*************************************************************************
template <typename U, size_t N>
ETL_CONSTEXPR poly_span(const std::array<U, N>& a) ETL_NOEXCEPT
template <typename U, size_t Size>
ETL_CONSTEXPR poly_span(const std::array<U, Size>& a) ETL_NOEXCEPT
: pbegin(a.data())
, element_size(sizeof(U))
{
ETL_STATIC_ASSERT(N <= Extent, "Array data overflow");
ETL_STATIC_ASSERT(Size <= Extent, "Array data overflow");
ETL_STATIC_ASSERT((etl::is_base_of<TBase, U>::value || etl::is_same<TBase, U>::value), "TBase not a base of U");
}
#endif
@ -682,11 +682,11 @@ namespace etl
//*************************************************************************
/// Construct from C array
//*************************************************************************
template<typename U, size_t N>
ETL_CONSTEXPR poly_span(U(&begin_)[N]) ETL_NOEXCEPT
template<typename U, size_t Size>
ETL_CONSTEXPR poly_span(U(&begin_)[Size]) ETL_NOEXCEPT
: pbegin(begin_)
, element_size(sizeof(U))
, span_extent(N)
, span_extent(Size)
{
ETL_STATIC_ASSERT((etl::is_base_of<TBase, U>::value || etl::is_same<TBase, U>::value), "TBase not a base of the data type");
}
@ -694,11 +694,11 @@ namespace etl
//*************************************************************************
/// Construct from etl::array.
//*************************************************************************
template <typename U, size_t N>
ETL_CONSTEXPR poly_span(etl::array<U, N>& a) ETL_NOEXCEPT
template <typename U, size_t Size>
ETL_CONSTEXPR poly_span(etl::array<U, Size>& a) ETL_NOEXCEPT
: pbegin(a.data())
, element_size(sizeof(U))
, span_extent(N)
, span_extent(Size)
{
ETL_STATIC_ASSERT((etl::is_base_of<TBase, U>::value || etl::is_same<TBase, U>::value), "TBase not a base of the data type");
}
@ -706,11 +706,11 @@ namespace etl
//*************************************************************************
/// Construct from etl::array.
//*************************************************************************
template <typename U, size_t N>
ETL_CONSTEXPR poly_span(const etl::array<U, N>& a) ETL_NOEXCEPT
template <typename U, size_t Size>
ETL_CONSTEXPR poly_span(const etl::array<U, Size>& a) ETL_NOEXCEPT
: pbegin(a.data())
, element_size(sizeof(U))
, span_extent(N)
, span_extent(Size)
{
ETL_STATIC_ASSERT((etl::is_base_of<TBase, U>::value || etl::is_same<TBase, U>::value), "TBase not a base of the data type");
}
@ -719,11 +719,11 @@ namespace etl
//*************************************************************************
/// Construct from std::array.
//*************************************************************************
template <typename U, size_t N>
ETL_CONSTEXPR poly_span(std::array<U, N>& a) ETL_NOEXCEPT
template <typename U, size_t Size>
ETL_CONSTEXPR poly_span(std::array<U, Size>& a) ETL_NOEXCEPT
: pbegin(a.data())
, element_size(sizeof(U))
, span_extent(N)
, span_extent(Size)
{
ETL_STATIC_ASSERT((etl::is_base_of<TBase, U>::value || etl::is_same<TBase, U>::value), "TBase not a base of U");
}
@ -731,11 +731,11 @@ namespace etl
//*************************************************************************
/// Construct from std::array.
//*************************************************************************
template <typename U, size_t N>
ETL_CONSTEXPR poly_span(const std::array<U, N>& a) ETL_NOEXCEPT
template <typename U, size_t Size>
ETL_CONSTEXPR poly_span(const std::array<U, Size>& a) ETL_NOEXCEPT
: pbegin(a.data())
, element_size(sizeof(U))
, span_extent(N)
, span_extent(Size)
{
ETL_STATIC_ASSERT((etl::is_base_of<TBase, U>::value || etl::is_same<TBase, U>::value), "TBase not a base of U");
}
@ -1002,26 +1002,26 @@ protected:
poly_span(const TIterator begin_, const TSize size_)
->poly_span<etl::remove_pointer_t<TIterator>, etl::dynamic_extent>;
template <typename T, size_t N>
poly_span(T(&)[N])
->poly_span<T, N>;
template <typename T, size_t Size>
poly_span(T(&)[Size])
->poly_span<T, Size>;
template <typename T, size_t N>
poly_span(etl::array<T, N>&)
->poly_span<T, N>;
template <typename T, size_t Size>
poly_span(etl::array<T, Size>&)
->poly_span<T, Size>;
template <typename T, size_t N>
poly_span(const etl::array<T, N>&)
->poly_span<const T, N>;
template <typename T, size_t Size>
poly_span(const etl::array<T, Size>&)
->poly_span<const T, Size>;
#if ETL_USING_STL
template <typename T, size_t N>
poly_span(std::array<T, N>&)
->poly_span<T, N>;
template <typename T, size_t Size>
poly_span(std::array<T, Size>&)
->poly_span<T, Size>;
template <typename T, size_t N>
poly_span(const std::array<T, N>&)
->poly_span<const T, N>;
template <typename T, size_t Size>
poly_span(const std::array<T, Size>&)
->poly_span<const T, Size>;
#endif
#endif

View File

@ -38,7 +38,7 @@ SOFTWARE.
#include <stdint.h>
///\defgroup power power
/// power<N, POWER> : Calculates N to the power POWER.
/// power<N, Power> : Calculates N to the power Power.
///\ingroup maths
namespace etl
@ -55,46 +55,46 @@ namespace etl
//***************************************************************************
///\ingroup power
/// Calculates powers.
///\note Only supports positive N.
///\note Only supports positive Value.
//***************************************************************************
template <size_t NV, size_t POWER>
template <size_t Value, size_t Power>
struct power
{
static ETL_CONSTANT private_power::type value = NV * power<NV, POWER - 1>::value;
static ETL_CONSTANT private_power::type value = Value * power<Value, Power - 1>::value;
};
template <size_t NV, size_t POWER>
ETL_CONSTANT private_power::type power<NV, POWER>::value;
template <size_t Value, size_t Power>
ETL_CONSTANT private_power::type power<Value, Power>::value;
//***************************************************************************
/// Calculates powers.
///\note Only supports positive N.
/// Specialisation for POWER == 0.
///\note Only supports positive Value.
/// Specialisation for Power == 0.
//***************************************************************************
template <size_t NV>
struct power<NV, 0>
template <size_t Value>
struct power<Value, 0>
{
static ETL_CONSTANT private_power::type value = 1;
};
template <size_t NV>
ETL_CONSTANT private_power::type power<NV, 0>::value;
template <size_t Value>
ETL_CONSTANT private_power::type power<Value, 0>::value;
#if ETL_USING_CPP17
template <size_t NV, size_t POWER>
inline constexpr size_t power_v = power<NV, POWER>::value;
template <size_t Value, size_t Power>
inline constexpr size_t power_v = power<Value, Power>::value;
#endif
//***************************************************************************
///\ingroup power
/// Calculates the rounded up power of 2.
//***************************************************************************
template <size_t NV>
template <size_t Value>
struct power_of_2_round_up
{
enum value_type
{
value = 1 << (etl::log2<NV - 1>::value + 1)
value = 1 << (etl::log2<Value - 1>::value + 1)
};
};
@ -113,20 +113,20 @@ namespace etl
};
#if ETL_USING_CPP17
template <size_t NV>
inline constexpr size_t power_of_2_round_up_v = power_of_2_round_up<NV>::value;
template <size_t Value>
inline constexpr size_t power_of_2_round_up_v = power_of_2_round_up<Value>::value;
#endif
//***************************************************************************
///\ingroup power
/// Calculates the rounded down power of 2.
//***************************************************************************
template <size_t NV>
template <size_t Value>
struct power_of_2_round_down
{
enum value_type
{
value = 1 << (etl::log2<NV - 1>::value)
value = 1 << (etl::log2<Value - 1>::value)
};
};
@ -173,18 +173,18 @@ namespace etl
};
#if ETL_USING_CPP17
template <size_t NV>
inline constexpr size_t power_of_2_round_down_v = power_of_2_round_down<NV>::value;
template <size_t Value>
inline constexpr size_t power_of_2_round_down_v = power_of_2_round_down<Value>::value;
#endif
//***************************************************************************
///\ingroup power
/// Checks if N is a power of 2.
//***************************************************************************
template <size_t NV>
template <size_t Value>
struct is_power_of_2
{
static ETL_CONSTANT bool value = (NV & (NV - 1)) == 0;
static ETL_CONSTANT bool value = (Value & (Value - 1)) == 0;
};
//***************************************************************************
@ -209,12 +209,12 @@ namespace etl
static ETL_CONSTANT bool value = false;
};
template <size_t NV>
ETL_CONSTANT bool is_power_of_2<NV>::value;
template <size_t Value>
ETL_CONSTANT bool is_power_of_2<Value>::value;
#if ETL_USING_CPP17
template <size_t NV>
inline constexpr size_t is_power_of_2_v = is_power_of_2<NV>::value;
template <size_t Value>
inline constexpr size_t is_power_of_2_v = is_power_of_2<Value>::value;
#endif
}

View File

@ -66,7 +66,7 @@ namespace etl
/// Placeholder for unused template parameters.
/// This class is never instantiated.
//*************************************************************************
template <size_t ID>
template <size_t Id>
struct no_type
{
};

View File

@ -219,8 +219,8 @@ namespace etl
/// Copy constructor
/// From fixed extent span.
//*************************************************************************
template <typename U, size_t N>
ETL_CONSTEXPR span(const etl::span<U, N>& other, typename etl::enable_if<N == Extent, void>::type* = 0) ETL_NOEXCEPT
template <typename U, size_t Size>
ETL_CONSTEXPR span(const etl::span<U, Size>& other, typename etl::enable_if<Size == Extent, void>::type* = 0) ETL_NOEXCEPT
: pbegin(other.data())
{
}
@ -229,8 +229,8 @@ namespace etl
/// Copy constructor
/// From dynamic extent span.
//*************************************************************************
template <typename U, size_t N>
ETL_CONSTEXPR14 span(const etl::span<U, N>& other, typename etl::enable_if<N == etl::dynamic_extent, void>::type* = 0)
template <typename U, size_t Size>
ETL_CONSTEXPR14 span(const etl::span<U, Size>& other, typename etl::enable_if<Size == etl::dynamic_extent, void>::type* = 0)
: pbegin(other.data())
{
ETL_ASSERT(other.size() == Extent, ETL_ERROR(span_size_mismatch));
@ -657,8 +657,8 @@ namespace etl
//*************************************************************************
/// Copy constructor
//*************************************************************************
template <typename U, size_t N>
ETL_CONSTEXPR span(const etl::span<U, N>& other) ETL_NOEXCEPT
template <typename U, size_t Size>
ETL_CONSTEXPR span(const etl::span<U, Size>& other) ETL_NOEXCEPT
: pbegin(other.data())
, pend(other.data() + other.size())
{
@ -1082,26 +1082,26 @@ namespace etl
span(const TIterator begin_, const TSize size_)
->span<etl::remove_pointer_t<TIterator>, etl::dynamic_extent>;
template <typename T, size_t N>
span(T(&)[N])
-> span<T, N>;
template <typename T, size_t Size>
span(T(&)[Size])
-> span<T, Size>;
template <typename T, size_t N>
span(etl::array<T, N>&)
-> span<T, N>;
template <typename T, size_t Size>
span(etl::array<T, Size>&)
-> span<T, Size>;
template <typename T, size_t N>
span(const etl::array<T, N>&)
-> span<const T, N>;
template <typename T, size_t Size>
span(const etl::array<T, Size>&)
-> span<const T, Size>;
#if ETL_USING_STL && ETL_USING_CPP11
template <typename T, size_t N>
span(std::array<T, N>&)
->span<T, N>;
template <typename T, size_t Size>
span(std::array<T, Size>&)
->span<T, Size>;
template <typename T, size_t N>
span(const std::array<T, N>&)
->span<const T, N>;
template <typename T, size_t Size>
span(const std::array<T, Size>&)
->span<const T, Size>;
#endif
#endif
@ -1123,22 +1123,22 @@ namespace etl
//*************************************************************************
/// Obtains a view to the byte representation of the elements of the span s.
//*************************************************************************
template <class T, size_t N>
span<const byte, (N == etl::dynamic_extent) ? (etl::dynamic_extent) : (N * sizeof(T))>
as_bytes(span<T, N> s) ETL_NOEXCEPT
template <class T, size_t Size>
span<const byte, (Size == etl::dynamic_extent) ? (etl::dynamic_extent) : (Size * sizeof(T))>
as_bytes(span<T, Size> s) ETL_NOEXCEPT
{
return span<const byte, (N == etl::dynamic_extent) ? (etl::dynamic_extent) : (N * sizeof(T))>(reinterpret_cast<byte*>(s.data()), s.size_bytes());
return span<const byte, (Size == etl::dynamic_extent) ? (etl::dynamic_extent) : (Size * sizeof(T))>(reinterpret_cast<byte*>(s.data()), s.size_bytes());
}
//*************************************************************************
/// Obtains a view to the byte representation of the elements of the span s.
//*************************************************************************
template <class T, size_t N>
span<byte, (N == etl::dynamic_extent) ? (etl::dynamic_extent) : (N * sizeof(T))>
as_writable_bytes(span<T, N> s) ETL_NOEXCEPT
template <class T, size_t Size>
span<byte, (Size == etl::dynamic_extent) ? (etl::dynamic_extent) : (Size * sizeof(T))>
as_writable_bytes(span<T, Size> s) ETL_NOEXCEPT
{
ETL_STATIC_ASSERT(!etl::is_const<T>::value, "span<T> must be of non-const type");
return span<byte, (N == etl::dynamic_extent) ? (etl::dynamic_extent) : (N * sizeof(T))>(reinterpret_cast<byte*>(s.data()), s.size_bytes());
return span<byte, (Size == etl::dynamic_extent) ? (etl::dynamic_extent) : (Size * sizeof(T))>(reinterpret_cast<byte*>(s.data()), s.size_bytes());
}
}

View File

@ -40,14 +40,14 @@ SOFTWARE.
namespace etl
{
//***************************************************************************
/// Calculates the smallest value that, when squared, will be not greater than VALUE.
/// Calculates the smallest value that, when squared, will be not greater than Value.
//***************************************************************************
template <size_t VALUE, size_t I = 1>
template <size_t Value, size_t Root = 1>
struct sqrt
{
typedef typename etl::conditional<((I * I) > VALUE),
etl::constant<intmax_t, I - 1>,
etl::sqrt<VALUE, I + 1> >::type type;
typedef typename etl::conditional<((Root * Root) > Value),
etl::constant<intmax_t, Root - 1>,
etl::sqrt<Value, Root + 1> >::type type;
#if ETL_USING_CPP11
static constexpr size_t value = type::value;
@ -61,13 +61,13 @@ namespace etl
};
#if ETL_USING_CPP11
template <size_t VALUE, size_t I>
constexpr size_t sqrt<VALUE, I>::value;
template <size_t Value, size_t Root>
constexpr size_t sqrt<Value, Root>::value;
#endif
#if ETL_USING_CPP17
template <size_t VALUE, size_t I = 1>
inline constexpr size_t sqrt_v = sqrt<VALUE, I>::value;
template <size_t Value, size_t Root = 1>
inline constexpr size_t sqrt_v = sqrt<Value, Root>::value;
#endif
}

View File

@ -1146,12 +1146,12 @@ namespace etl
}
// Recursive case: compare the current element and recurse.
template <typename TTuple1, typename TTuple2, size_t I, size_t... Indices>
template <typename TTuple1, typename TTuple2, size_t Index, size_t... Indices>
ETL_NODISCARD
ETL_CONSTEXPR14
bool tuple_equality(const TTuple1& lhs, const TTuple2& rhs, etl::index_sequence<I, Indices...>)
bool tuple_equality(const TTuple1& lhs, const TTuple2& rhs, etl::index_sequence<Index, Indices...>)
{
return etl::get<I>(lhs) == etl::get<I>(rhs) && tuple_equality(lhs, rhs, etl::index_sequence<Indices...>{});
return etl::get<Index>(lhs) == etl::get<Index>(rhs) && tuple_equality(lhs, rhs, etl::index_sequence<Indices...>{});
}
//***************************************************************************
@ -1167,17 +1167,17 @@ namespace etl
}
// Recursively compare the current element and the rest.
template <typename TTuple1, typename TTuple2, size_t I, size_t... Indices>
template <typename TTuple1, typename TTuple2, size_t Index, size_t... Indices>
ETL_NODISCARD
ETL_CONSTEXPR14
bool tuple_less_than(const TTuple1& lhs, const TTuple2& rhs, etl::index_sequence<I, Indices...>)
bool tuple_less_than(const TTuple1& lhs, const TTuple2& rhs, etl::index_sequence<Index, Indices...>)
{
if (get<I>(lhs) < get<I>(rhs))
if (get<Index>(lhs) < get<Index>(rhs))
{
return true;
}
if (get<I>(rhs) < get<I>(lhs))
if (get<Index>(rhs) < get<Index>(lhs))
{
return false;
}
@ -1282,7 +1282,7 @@ namespace std
template <typename T>
struct tuple_size;
template <size_t I, typename TType>
template <size_t Index, typename TType>
struct tuple_element;
#endif
@ -1297,10 +1297,10 @@ namespace std
//***************************************************************************
/// Specialisation of tuple_element to allow the use of C++ structured bindings.
//***************************************************************************
template <size_t I, typename... Types>
struct tuple_element<I, etl::tuple<Types...>>
template <size_t Index, typename... Types>
struct tuple_element<Index, etl::tuple<Types...>>
{
using type = typename etl::nth_type_t<I, Types...>;
using type = typename etl::nth_type_t<Index, Types...>;
};
}

View File

@ -57,7 +57,7 @@ namespace etl
enum
{
ID = ID_
Id = ID_
};
};
@ -84,19 +84,19 @@ namespace etl
struct nulltype {};
// For N type pairs.
template <size_t ID, typename T1, typename... TRest>
template <size_t Id, typename T1, typename... TRest>
struct type_from_id_helper
{
using type = typename etl::conditional<ID == T1::ID,
using type = typename etl::conditional<Id == T1::Id,
typename T1::type,
typename type_from_id_helper<ID, TRest...>::type>::type;
typename type_from_id_helper<Id, TRest...>::type>::type;
};
// Specialisation for 1 type pair.
template <size_t ID, typename T1>
struct type_from_id_helper<ID, T1>
template <size_t Id, typename T1>
struct type_from_id_helper<Id, T1>
{
using type = typename etl::conditional<ID == T1::ID,
using type = typename etl::conditional<Id == T1::Id,
typename T1::type,
nulltype>::type;
};
@ -106,16 +106,16 @@ namespace etl
//************************************
// type_from_id
//************************************
template <int ID>
template <int Id>
struct type_from_id
{
using type = typename type_from_id_helper<ID, TTypes...>::type;
using type = typename type_from_id_helper<Id, TTypes...>::type;
static_assert(!(etl::is_same<nulltype, type>::value), "Invalid id");
};
template <int ID>
using type_from_id_t = typename type_from_id<ID>::type;
template <int Id>
using type_from_id_t = typename type_from_id<Id>::type;
private:
@ -125,14 +125,14 @@ namespace etl
template <typename T, typename T1, typename... TRest>
struct id_from_type_helper
{
static constexpr size_t value = etl::is_same<T, typename T1::type>::value ? size_t(T1::ID) : id_from_type_helper<T, TRest...>::value;
static constexpr size_t value = etl::is_same<T, typename T1::type>::value ? size_t(T1::Id) : id_from_type_helper<T, TRest...>::value;
};
// Specialisation for 1 type pair.
template <typename T, typename T1>
struct id_from_type_helper<T, T1>
{
static constexpr size_t value = etl::is_same<T, typename T1::type>::value ? size_t(T1::ID) : UNKNOWN;
static constexpr size_t value = etl::is_same<T, typename T1::type>::value ? size_t(T1::Id) : UNKNOWN;
};
public:
@ -239,26 +239,26 @@ namespace etl
public:
//************************************
template <int ID>
template <int Id>
struct type_from_id
{
typedef
typename etl::conditional<ID == T1::ID, typename T1::type,
typename etl::conditional<ID == T2::ID, typename T2::type,
typename etl::conditional<ID == T3::ID, typename T3::type,
typename etl::conditional<ID == T4::ID, typename T4::type,
typename etl::conditional<ID == T5::ID, typename T5::type,
typename etl::conditional<ID == T6::ID, typename T6::type,
typename etl::conditional<ID == T7::ID, typename T7::type,
typename etl::conditional<ID == T8::ID, typename T8::type,
typename etl::conditional<ID == T9::ID, typename T9::type,
typename etl::conditional<ID == T10::ID, typename T10::type,
typename etl::conditional<ID == T11::ID, typename T11::type,
typename etl::conditional<ID == T12::ID, typename T12::type,
typename etl::conditional<ID == T13::ID, typename T13::type,
typename etl::conditional<ID == T14::ID, typename T14::type,
typename etl::conditional<ID == T15::ID, typename T15::type,
typename etl::conditional<ID == T16::ID, typename T16::type,
typename etl::conditional<Id == T1::Id, typename T1::type,
typename etl::conditional<Id == T2::Id, typename T2::type,
typename etl::conditional<Id == T3::Id, typename T3::type,
typename etl::conditional<Id == T4::Id, typename T4::type,
typename etl::conditional<Id == T5::Id, typename T5::type,
typename etl::conditional<Id == T6::Id, typename T6::type,
typename etl::conditional<Id == T7::Id, typename T7::type,
typename etl::conditional<Id == T8::Id, typename T8::type,
typename etl::conditional<Id == T9::Id, typename T9::type,
typename etl::conditional<Id == T10::Id, typename T10::type,
typename etl::conditional<Id == T11::Id, typename T11::type,
typename etl::conditional<Id == T12::Id, typename T12::type,
typename etl::conditional<Id == T13::Id, typename T13::type,
typename etl::conditional<Id == T14::Id, typename T14::type,
typename etl::conditional<Id == T15::Id, typename T15::type,
typename etl::conditional<Id == T16::Id, typename T16::type,
etl::null_type<0> >::type>::type>::type>::type>
::type>::type>::type>::type>
::type>::type>::type>::type>
@ -279,22 +279,22 @@ namespace etl
enum
{
value =
(unsigned int) etl::is_same<T, typename T1::type>::value ? (unsigned int)T1::ID :
(unsigned int) etl::is_same<T, typename T2::type>::value ? (unsigned int)T2::ID :
(unsigned int) etl::is_same<T, typename T3::type>::value ? (unsigned int)T3::ID :
(unsigned int) etl::is_same<T, typename T4::type>::value ? (unsigned int)T4::ID :
(unsigned int) etl::is_same<T, typename T5::type>::value ? (unsigned int)T5::ID :
(unsigned int) etl::is_same<T, typename T6::type>::value ? (unsigned int)T6::ID :
(unsigned int) etl::is_same<T, typename T7::type>::value ? (unsigned int)T7::ID :
(unsigned int) etl::is_same<T, typename T8::type>::value ? (unsigned int)T8::ID :
(unsigned int) etl::is_same<T, typename T9::type>::value ? (unsigned int)T9::ID :
(unsigned int) etl::is_same<T, typename T10::type>::value ? (unsigned int)T10::ID :
(unsigned int) etl::is_same<T, typename T11::type>::value ? (unsigned int)T11::ID :
(unsigned int) etl::is_same<T, typename T12::type>::value ? (unsigned int)T12::ID :
(unsigned int) etl::is_same<T, typename T13::type>::value ? (unsigned int)T13::ID :
(unsigned int) etl::is_same<T, typename T14::type>::value ? (unsigned int)T14::ID :
(unsigned int) etl::is_same<T, typename T15::type>::value ? (unsigned int)T15::ID :
(unsigned int) etl::is_same<T, typename T16::type>::value ? (unsigned int)T16::ID :
(unsigned int) etl::is_same<T, typename T1::type>::value ? (unsigned int)T1::Id :
(unsigned int) etl::is_same<T, typename T2::type>::value ? (unsigned int)T2::Id :
(unsigned int) etl::is_same<T, typename T3::type>::value ? (unsigned int)T3::Id :
(unsigned int) etl::is_same<T, typename T4::type>::value ? (unsigned int)T4::Id :
(unsigned int) etl::is_same<T, typename T5::type>::value ? (unsigned int)T5::Id :
(unsigned int) etl::is_same<T, typename T6::type>::value ? (unsigned int)T6::Id :
(unsigned int) etl::is_same<T, typename T7::type>::value ? (unsigned int)T7::Id :
(unsigned int) etl::is_same<T, typename T8::type>::value ? (unsigned int)T8::Id :
(unsigned int) etl::is_same<T, typename T9::type>::value ? (unsigned int)T9::Id :
(unsigned int) etl::is_same<T, typename T10::type>::value ? (unsigned int)T10::Id :
(unsigned int) etl::is_same<T, typename T11::type>::value ? (unsigned int)T11::Id :
(unsigned int) etl::is_same<T, typename T12::type>::value ? (unsigned int)T12::Id :
(unsigned int) etl::is_same<T, typename T13::type>::value ? (unsigned int)T13::Id :
(unsigned int) etl::is_same<T, typename T14::type>::value ? (unsigned int)T14::Id :
(unsigned int) etl::is_same<T, typename T15::type>::value ? (unsigned int)T15::Id :
(unsigned int) etl::is_same<T, typename T16::type>::value ? (unsigned int)T16::Id :
(unsigned int) UNKNOWN
};

View File

@ -54,40 +54,40 @@ namespace etl
private:
//***********************************
template <size_t ID, size_t N, typename T1, typename... TRest>
template <size_t Id, size_t Index, typename T1, typename... TRest>
struct type_select_helper
{
using type = typename etl::conditional<ID == N,
using type = typename etl::conditional<Id == Index,
T1,
typename type_select_helper<ID, N + 1, TRest...>::type>::type;
typename type_select_helper<Id, Index + 1, TRest...>::type>::type;
};
//***********************************
template <size_t ID, size_t N, typename T1>
struct type_select_helper<ID, N, T1>
template <size_t Id, size_t Index, typename T1>
struct type_select_helper<Id, Index, T1>
{
using type = T1;
};
public:
template <size_t ID>
template <size_t Id>
struct select
{
static_assert(ID < sizeof...(TTypes), "Illegal type_select::select index");
static_assert(Id < sizeof...(TTypes), "Illegal type_select::select index");
using type = typename type_select_helper<ID, 0, TTypes...>::type;
using type = typename type_select_helper<Id, 0, TTypes...>::type;
};
template <size_t ID>
using select_t = typename select<ID>::type;
template <size_t Id>
using select_t = typename select<Id>::type;
};
//***************************************************************************
// Select type alias
//***************************************************************************
template <size_t N, typename... TTypes>
using type_select_t = typename etl::type_select<TTypes...>:: template select_t<N>;
template <size_t Index, typename... TTypes>
using type_select_t = typename etl::type_select<TTypes...>:: template select_t<Index>;
#else
@ -114,30 +114,30 @@ namespace etl
{
public:
template <size_t ID>
template <size_t Id>
struct select
{
typedef typename etl::conditional<ID == 0, T0,
typename etl::conditional<ID == 1, T1,
typename etl::conditional<ID == 2, T2,
typename etl::conditional<ID == 3, T3,
typename etl::conditional<ID == 4, T4,
typename etl::conditional<ID == 5, T5,
typename etl::conditional<ID == 6, T6,
typename etl::conditional<ID == 7, T7,
typename etl::conditional<ID == 8, T8,
typename etl::conditional<ID == 9, T9,
typename etl::conditional<ID == 10, T10,
typename etl::conditional<ID == 11, T11,
typename etl::conditional<ID == 12, T12,
typename etl::conditional<ID == 13, T13,
typename etl::conditional<ID == 14, T14,
typename etl::conditional<ID == 15, T15,
typedef typename etl::conditional<Id == 0, T0,
typename etl::conditional<Id == 1, T1,
typename etl::conditional<Id == 2, T2,
typename etl::conditional<Id == 3, T3,
typename etl::conditional<Id == 4, T4,
typename etl::conditional<Id == 5, T5,
typename etl::conditional<Id == 6, T6,
typename etl::conditional<Id == 7, T7,
typename etl::conditional<Id == 8, T8,
typename etl::conditional<Id == 9, T9,
typename etl::conditional<Id == 10, T10,
typename etl::conditional<Id == 11, T11,
typename etl::conditional<Id == 12, T12,
typename etl::conditional<Id == 13, T13,
typename etl::conditional<Id == 14, T14,
typename etl::conditional<Id == 15, T15,
etl::null_type<0> >
::type>::type>::type>::type>::type>::type>::type>::type>
::type>::type>::type>::type>::type>::type>::type>::type type;
ETL_STATIC_ASSERT(ID < 16, "Invalid ID");
ETL_STATIC_ASSERT(Id < 16, "Invalid Id");
};
};
@ -162,29 +162,29 @@ namespace etl
struct type_select<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>
{
public:
template <size_t ID>
template <size_t Id>
struct select
{
typedef typename etl::conditional<ID == 0, T0,
typename etl::conditional<ID == 1, T1,
typename etl::conditional<ID == 2, T2,
typename etl::conditional<ID == 3, T3,
typename etl::conditional<ID == 4, T4,
typename etl::conditional<ID == 5, T5,
typename etl::conditional<ID == 6, T6,
typename etl::conditional<ID == 7, T7,
typename etl::conditional<ID == 8, T8,
typename etl::conditional<ID == 9, T9,
typename etl::conditional<ID == 10, T10,
typename etl::conditional<ID == 11, T11,
typename etl::conditional<ID == 12, T12,
typename etl::conditional<ID == 13, T13,
typename etl::conditional<ID == 14, T14,
typedef typename etl::conditional<Id == 0, T0,
typename etl::conditional<Id == 1, T1,
typename etl::conditional<Id == 2, T2,
typename etl::conditional<Id == 3, T3,
typename etl::conditional<Id == 4, T4,
typename etl::conditional<Id == 5, T5,
typename etl::conditional<Id == 6, T6,
typename etl::conditional<Id == 7, T7,
typename etl::conditional<Id == 8, T8,
typename etl::conditional<Id == 9, T9,
typename etl::conditional<Id == 10, T10,
typename etl::conditional<Id == 11, T11,
typename etl::conditional<Id == 12, T12,
typename etl::conditional<Id == 13, T13,
typename etl::conditional<Id == 14, T14,
etl::null_type<0> >
::type>::type>::type>::type>::type>::type>::type>::type>
::type>::type>::type>::type>::type>::type>::type type;
ETL_STATIC_ASSERT(ID < 15, "Invalid ID");
ETL_STATIC_ASSERT(Id < 15, "Invalid Id");
};
};
@ -208,28 +208,28 @@ namespace etl
struct type_select<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>
{
public:
template <size_t ID>
template <size_t Id>
struct select
{
typedef typename etl::conditional<ID == 0, T0,
typename etl::conditional<ID == 1, T1,
typename etl::conditional<ID == 2, T2,
typename etl::conditional<ID == 3, T3,
typename etl::conditional<ID == 4, T4,
typename etl::conditional<ID == 5, T5,
typename etl::conditional<ID == 6, T6,
typename etl::conditional<ID == 7, T7,
typename etl::conditional<ID == 8, T8,
typename etl::conditional<ID == 9, T9,
typename etl::conditional<ID == 10, T10,
typename etl::conditional<ID == 11, T11,
typename etl::conditional<ID == 12, T12,
typename etl::conditional<ID == 13, T13,
typedef typename etl::conditional<Id == 0, T0,
typename etl::conditional<Id == 1, T1,
typename etl::conditional<Id == 2, T2,
typename etl::conditional<Id == 3, T3,
typename etl::conditional<Id == 4, T4,
typename etl::conditional<Id == 5, T5,
typename etl::conditional<Id == 6, T6,
typename etl::conditional<Id == 7, T7,
typename etl::conditional<Id == 8, T8,
typename etl::conditional<Id == 9, T9,
typename etl::conditional<Id == 10, T10,
typename etl::conditional<Id == 11, T11,
typename etl::conditional<Id == 12, T12,
typename etl::conditional<Id == 13, T13,
etl::null_type<0> >
::type>::type>::type>::type>::type>::type>::type>::type>
::type>::type>::type>::type>::type>::type type;
ETL_STATIC_ASSERT(ID < 14, "Invalid ID");
ETL_STATIC_ASSERT(Id < 14, "Invalid Id");
};
};
@ -252,27 +252,27 @@ namespace etl
struct type_select<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>
{
public:
template <size_t ID>
template <size_t Id>
struct select
{
typedef typename etl::conditional<ID == 0, T0,
typename etl::conditional<ID == 1, T1,
typename etl::conditional<ID == 2, T2,
typename etl::conditional<ID == 3, T3,
typename etl::conditional<ID == 4, T4,
typename etl::conditional<ID == 5, T5,
typename etl::conditional<ID == 6, T6,
typename etl::conditional<ID == 7, T7,
typename etl::conditional<ID == 8, T8,
typename etl::conditional<ID == 9, T9,
typename etl::conditional<ID == 10, T10,
typename etl::conditional<ID == 11, T11,
typename etl::conditional<ID == 12, T12,
typedef typename etl::conditional<Id == 0, T0,
typename etl::conditional<Id == 1, T1,
typename etl::conditional<Id == 2, T2,
typename etl::conditional<Id == 3, T3,
typename etl::conditional<Id == 4, T4,
typename etl::conditional<Id == 5, T5,
typename etl::conditional<Id == 6, T6,
typename etl::conditional<Id == 7, T7,
typename etl::conditional<Id == 8, T8,
typename etl::conditional<Id == 9, T9,
typename etl::conditional<Id == 10, T10,
typename etl::conditional<Id == 11, T11,
typename etl::conditional<Id == 12, T12,
etl::null_type<0> >
::type>::type>::type>::type>::type>::type>::type>::type>
::type>::type>::type>::type>::type type;
ETL_STATIC_ASSERT(ID < 13, "Invalid ID");
ETL_STATIC_ASSERT(Id < 13, "Invalid Id");
};
};
@ -294,26 +294,26 @@ namespace etl
struct type_select<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>
{
public:
template <size_t ID>
template <size_t Id>
struct select
{
typedef typename etl::conditional<ID == 0, T0,
typename etl::conditional<ID == 1, T1,
typename etl::conditional<ID == 2, T2,
typename etl::conditional<ID == 3, T3,
typename etl::conditional<ID == 4, T4,
typename etl::conditional<ID == 5, T5,
typename etl::conditional<ID == 6, T6,
typename etl::conditional<ID == 7, T7,
typename etl::conditional<ID == 8, T8,
typename etl::conditional<ID == 9, T9,
typename etl::conditional<ID == 10, T10,
typename etl::conditional<ID == 11, T11,
typedef typename etl::conditional<Id == 0, T0,
typename etl::conditional<Id == 1, T1,
typename etl::conditional<Id == 2, T2,
typename etl::conditional<Id == 3, T3,
typename etl::conditional<Id == 4, T4,
typename etl::conditional<Id == 5, T5,
typename etl::conditional<Id == 6, T6,
typename etl::conditional<Id == 7, T7,
typename etl::conditional<Id == 8, T8,
typename etl::conditional<Id == 9, T9,
typename etl::conditional<Id == 10, T10,
typename etl::conditional<Id == 11, T11,
etl::null_type<0> >
::type>::type>::type>::type>::type>::type>::type>::type>
::type>::type>::type>::type type;
ETL_STATIC_ASSERT(ID < 12, "Invalid ID");
ETL_STATIC_ASSERT(Id < 12, "Invalid Id");
};
};
@ -334,25 +334,25 @@ namespace etl
struct type_select<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>
{
public:
template <size_t ID>
template <size_t Id>
struct select
{
typedef typename etl::conditional<ID == 0, T0,
typename etl::conditional<ID == 1, T1,
typename etl::conditional<ID == 2, T2,
typename etl::conditional<ID == 3, T3,
typename etl::conditional<ID == 4, T4,
typename etl::conditional<ID == 5, T5,
typename etl::conditional<ID == 6, T6,
typename etl::conditional<ID == 7, T7,
typename etl::conditional<ID == 8, T8,
typename etl::conditional<ID == 9, T9,
typename etl::conditional<ID == 10, T10,
typedef typename etl::conditional<Id == 0, T0,
typename etl::conditional<Id == 1, T1,
typename etl::conditional<Id == 2, T2,
typename etl::conditional<Id == 3, T3,
typename etl::conditional<Id == 4, T4,
typename etl::conditional<Id == 5, T5,
typename etl::conditional<Id == 6, T6,
typename etl::conditional<Id == 7, T7,
typename etl::conditional<Id == 8, T8,
typename etl::conditional<Id == 9, T9,
typename etl::conditional<Id == 10, T10,
etl::null_type<0> >
::type>::type>::type>::type>::type>::type>::type>::type>
::type>::type>::type type;
ETL_STATIC_ASSERT(ID < 11, "Invalid ID");
ETL_STATIC_ASSERT(Id < 11, "Invalid Id");
};
};
@ -372,24 +372,24 @@ namespace etl
struct type_select<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>
{
public:
template <size_t ID>
template <size_t Id>
struct select
{
typedef typename etl::conditional<ID == 0, T0,
typename etl::conditional<ID == 1, T1,
typename etl::conditional<ID == 2, T2,
typename etl::conditional<ID == 3, T3,
typename etl::conditional<ID == 4, T4,
typename etl::conditional<ID == 5, T5,
typename etl::conditional<ID == 6, T6,
typename etl::conditional<ID == 7, T7,
typename etl::conditional<ID == 8, T8,
typename etl::conditional<ID == 9, T9,
typedef typename etl::conditional<Id == 0, T0,
typename etl::conditional<Id == 1, T1,
typename etl::conditional<Id == 2, T2,
typename etl::conditional<Id == 3, T3,
typename etl::conditional<Id == 4, T4,
typename etl::conditional<Id == 5, T5,
typename etl::conditional<Id == 6, T6,
typename etl::conditional<Id == 7, T7,
typename etl::conditional<Id == 8, T8,
typename etl::conditional<Id == 9, T9,
etl::null_type<0> >
::type>::type>::type>::type>::type>::type>::type>::type>
::type>::type type;
ETL_STATIC_ASSERT(ID < 10, "Invalid ID");
ETL_STATIC_ASSERT(Id < 10, "Invalid Id");
};
};
@ -408,23 +408,23 @@ namespace etl
struct type_select<T0, T1, T2, T3, T4, T5, T6, T7, T8>
{
public:
template <size_t ID>
template <size_t Id>
struct select
{
typedef typename etl::conditional<ID == 0, T0,
typename etl::conditional<ID == 1, T1,
typename etl::conditional<ID == 2, T2,
typename etl::conditional<ID == 3, T3,
typename etl::conditional<ID == 4, T4,
typename etl::conditional<ID == 5, T5,
typename etl::conditional<ID == 6, T6,
typename etl::conditional<ID == 7, T7,
typename etl::conditional<ID == 8, T8,
typedef typename etl::conditional<Id == 0, T0,
typename etl::conditional<Id == 1, T1,
typename etl::conditional<Id == 2, T2,
typename etl::conditional<Id == 3, T3,
typename etl::conditional<Id == 4, T4,
typename etl::conditional<Id == 5, T5,
typename etl::conditional<Id == 6, T6,
typename etl::conditional<Id == 7, T7,
typename etl::conditional<Id == 8, T8,
etl::null_type<0> >
::type>::type>::type>::type>::type>::type>::type>::type>
::type type;
ETL_STATIC_ASSERT(ID < 9, "Invalid ID");
ETL_STATIC_ASSERT(Id < 9, "Invalid Id");
};
};
@ -442,21 +442,21 @@ namespace etl
struct type_select<T0, T1, T2, T3, T4, T5, T6, T7>
{
public:
template <size_t ID>
template <size_t Id>
struct select
{
typedef typename etl::conditional<ID == 0, T0,
typename etl::conditional<ID == 1, T1,
typename etl::conditional<ID == 2, T2,
typename etl::conditional<ID == 3, T3,
typename etl::conditional<ID == 4, T4,
typename etl::conditional<ID == 5, T5,
typename etl::conditional<ID == 6, T6,
typename etl::conditional<ID == 7, T7,
typedef typename etl::conditional<Id == 0, T0,
typename etl::conditional<Id == 1, T1,
typename etl::conditional<Id == 2, T2,
typename etl::conditional<Id == 3, T3,
typename etl::conditional<Id == 4, T4,
typename etl::conditional<Id == 5, T5,
typename etl::conditional<Id == 6, T6,
typename etl::conditional<Id == 7, T7,
etl::null_type<0> >
::type>::type>::type>::type>::type>::type>::type>::type type;
ETL_STATIC_ASSERT(ID < 8, "Invalid ID");
ETL_STATIC_ASSERT(Id < 8, "Invalid Id");
};
};
@ -473,20 +473,20 @@ namespace etl
struct type_select<T0, T1, T2, T3, T4, T5, T6>
{
public:
template <size_t ID>
template <size_t Id>
struct select
{
typedef typename etl::conditional<ID == 0, T0,
typename etl::conditional<ID == 1, T1,
typename etl::conditional<ID == 2, T2,
typename etl::conditional<ID == 3, T3,
typename etl::conditional<ID == 4, T4,
typename etl::conditional<ID == 5, T5,
typename etl::conditional<ID == 6, T6,
typedef typename etl::conditional<Id == 0, T0,
typename etl::conditional<Id == 1, T1,
typename etl::conditional<Id == 2, T2,
typename etl::conditional<Id == 3, T3,
typename etl::conditional<Id == 4, T4,
typename etl::conditional<Id == 5, T5,
typename etl::conditional<Id == 6, T6,
etl::null_type<0> >
::type>::type>::type>::type>::type>::type>::type type;
ETL_STATIC_ASSERT(ID < 7, "Invalid ID");
ETL_STATIC_ASSERT(Id < 7, "Invalid Id");
};
};
@ -502,19 +502,19 @@ namespace etl
struct type_select<T0, T1, T2, T3, T4, T5>
{
public:
template <size_t ID>
template <size_t Id>
struct select
{
typedef typename etl::conditional<ID == 0, T0,
typename etl::conditional<ID == 1, T1,
typename etl::conditional<ID == 2, T2,
typename etl::conditional<ID == 3, T3,
typename etl::conditional<ID == 4, T4,
typename etl::conditional<ID == 5, T5,
typedef typename etl::conditional<Id == 0, T0,
typename etl::conditional<Id == 1, T1,
typename etl::conditional<Id == 2, T2,
typename etl::conditional<Id == 3, T3,
typename etl::conditional<Id == 4, T4,
typename etl::conditional<Id == 5, T5,
etl::null_type<0> >
::type>::type>::type>::type>::type>::type type;
ETL_STATIC_ASSERT(ID < 6, "Invalid ID");
ETL_STATIC_ASSERT(Id < 6, "Invalid Id");
};
};
@ -529,18 +529,18 @@ namespace etl
struct type_select<T0, T1, T2, T3, T4>
{
public:
template <size_t ID>
template <size_t Id>
struct select
{
typedef typename etl::conditional<ID == 0, T0,
typename etl::conditional<ID == 1, T1,
typename etl::conditional<ID == 2, T2,
typename etl::conditional<ID == 3, T3,
typename etl::conditional<ID == 4, T4,
typedef typename etl::conditional<Id == 0, T0,
typename etl::conditional<Id == 1, T1,
typename etl::conditional<Id == 2, T2,
typename etl::conditional<Id == 3, T3,
typename etl::conditional<Id == 4, T4,
etl::null_type<0> >
::type>::type>::type>::type>::type type;
ETL_STATIC_ASSERT(ID < 5, "Invalid ID");
ETL_STATIC_ASSERT(Id < 5, "Invalid Id");
};
};
@ -554,17 +554,17 @@ namespace etl
struct type_select<T0, T1, T2, T3>
{
public:
template <size_t ID>
template <size_t Id>
struct select
{
typedef typename etl::conditional<ID == 0, T0,
typename etl::conditional<ID == 1, T1,
typename etl::conditional<ID == 2, T2,
typename etl::conditional<ID == 3, T3,
typedef typename etl::conditional<Id == 0, T0,
typename etl::conditional<Id == 1, T1,
typename etl::conditional<Id == 2, T2,
typename etl::conditional<Id == 3, T3,
etl::null_type<0> >
::type>::type>::type>::type type;
ETL_STATIC_ASSERT(ID < 4, "Invalid ID");
ETL_STATIC_ASSERT(Id < 4, "Invalid Id");
};
};
@ -577,16 +577,16 @@ namespace etl
struct type_select<T0, T1, T2>
{
public:
template <size_t ID>
template <size_t Id>
struct select
{
typedef typename etl::conditional<ID == 0, T0,
typename etl::conditional<ID == 1, T1,
typename etl::conditional<ID == 2, T2,
typedef typename etl::conditional<Id == 0, T0,
typename etl::conditional<Id == 1, T1,
typename etl::conditional<Id == 2, T2,
etl::null_type<0> >
::type>::type>::type type;
ETL_STATIC_ASSERT(ID < 3, "Invalid ID");
ETL_STATIC_ASSERT(Id < 3, "Invalid Id");
};
};
@ -598,15 +598,15 @@ namespace etl
struct type_select<T0, T1>
{
public:
template <size_t ID>
template <size_t Id>
struct select
{
typedef typename etl::conditional<ID == 0, T0,
typename etl::conditional<ID == 1, T1,
typedef typename etl::conditional<Id == 0, T0,
typename etl::conditional<Id == 1, T1,
etl::null_type<0> >
::type>::type type;
ETL_STATIC_ASSERT(ID < 2, "Invalid ID");
ETL_STATIC_ASSERT(Id < 2, "Invalid Id");
};
};
@ -617,14 +617,14 @@ namespace etl
struct type_select<T0>
{
public:
template <size_t ID>
template <size_t Id>
struct select
{
typedef typename etl::conditional<ID == 0, T0,
typedef typename etl::conditional<Id == 0, T0,
etl::null_type<0> >
::type type;
ETL_STATIC_ASSERT(ID < 1, "Invalid ID");
ETL_STATIC_ASSERT(Id < 1, "Invalid Id");
};
};
#endif

View File

@ -1572,10 +1572,10 @@ typedef integral_constant<bool, true> true_type;
/// Requires that the class has defined 'base_type'.
//***************************************************************************
// Recursive definition of the type.
template <size_t N, typename TType>
template <size_t Index, typename TType>
struct nth_base
{
typedef typename nth_base<N - 1U, typename TType::base_type>::type type;
typedef typename nth_base<Index - 1U, typename TType::base_type>::type type;
};
template <typename TType>
@ -1585,8 +1585,8 @@ typedef integral_constant<bool, true> true_type;
};
#if ETL_USING_CPP11
template <size_t N, typename TType>
using nth_base_t = typename nth_base<N, TType>::type;
template <size_t Index, typename TType>
using nth_base_t = typename nth_base<Index, TType>::type;
#endif
//***************************************************************************

View File

@ -156,10 +156,10 @@ namespace etl
b = ETL_MOVE(temp);
}
template< class T, size_t N >
ETL_CONSTEXPR14 void swap(T(&a)[N], T(&b)[N]) ETL_NOEXCEPT
template< class T, size_t Size >
ETL_CONSTEXPR14 void swap(T(&a)[Size], T(&b)[Size]) ETL_NOEXCEPT
{
for (size_t i = 0UL; i < N; ++i)
for (size_t i = 0UL; i < Size; ++i)
{
swap(a[i], b[i]);
}
@ -545,13 +545,13 @@ namespace etl
namespace private_integer_sequence
{
template <size_t N, typename IndexSeq>
template <size_t Count, typename IndexSeq>
struct make_index_sequence;
template <size_t N, size_t... Indices>
struct make_index_sequence<N, etl::integer_sequence<size_t, Indices...>>
template <size_t Count, size_t... Indices>
struct make_index_sequence<Count, etl::integer_sequence<size_t, Indices...>>
{
using type = typename make_index_sequence<N - 1, etl::integer_sequence<size_t, N - 1, Indices...>>::type;
using type = typename make_index_sequence<Count - 1, etl::integer_sequence<size_t, Count - 1, Indices...>>::type;
};
template <size_t... Indices>
@ -562,8 +562,8 @@ namespace etl
}
//***********************************
template <size_t N>
using make_index_sequence = typename private_integer_sequence::make_index_sequence<N, etl::integer_sequence<size_t>>::type;
template <size_t Count>
using make_index_sequence = typename private_integer_sequence::make_index_sequence<Count, etl::integer_sequence<size_t>>::type;
template <typename... TTypes>
using make_index_sequence_for = typename private_integer_sequence::make_index_sequence<sizeof...(TTypes), etl::integer_sequence<size_t>>::type;
@ -634,14 +634,14 @@ namespace etl
#endif
//*************************
template <size_t I> struct in_place_index_t
template <size_t Index> struct in_place_index_t
{
explicit ETL_CONSTEXPR in_place_index_t() {}
};
#if ETL_USING_CPP17
template <size_t I>
inline constexpr in_place_index_t<I> in_place_index{};
template <size_t Index>
inline constexpr in_place_index_t<Index> in_place_index{};
#endif
#if ETL_USING_CPP11

View File

@ -1403,7 +1403,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_SILENCE_ALL_CXX23_DEPRECATION_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_SILENCE_ALL_CXX23_DEPRECATION_WARNINGS;%(PreprocessorDefinitions);N = 123456789;N</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../../unittest-cpp/;../../include;../../test</AdditionalIncludeDirectories>
<UndefinePreprocessorDefinitions>
</UndefinePreprocessorDefinitions>
@ -1429,7 +1429,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_SILENCE_ALL_CXX23_DEPRECATION_WARNINGS;ETL_NO_STL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_SILENCE_ALL_CXX23_DEPRECATION_WARNINGS;ETL_NO_STL;%(PreprocessorDefinitions);N = 123456789;N</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../../unittest-cpp/;../../include;../../test</AdditionalIncludeDirectories>
<UndefinePreprocessorDefinitions>
</UndefinePreprocessorDefinitions>
@ -1455,7 +1455,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_FORCE_TEST_CPP03_IMPLEMENTATION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_FORCE_TEST_CPP03_IMPLEMENTATION;%(PreprocessorDefinitions);N = 123456789;N</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../../unittest-cpp/;../../include;../../test</AdditionalIncludeDirectories>
<UndefinePreprocessorDefinitions>
</UndefinePreprocessorDefinitions>
@ -1481,7 +1481,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_FORCE_TEST_CPP03_IMPLEMENTATION;ETL_MESSAGES_ARE_NOT_VIRTUAL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_FORCE_TEST_CPP03_IMPLEMENTATION;ETL_MESSAGES_ARE_NOT_VIRTUAL;%(PreprocessorDefinitions);N = 123456789;N</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../../unittest-cpp/;../../include;../../test</AdditionalIncludeDirectories>
<UndefinePreprocessorDefinitions>
</UndefinePreprocessorDefinitions>
@ -1507,7 +1507,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_MESSAGES_ARE_NOT_VIRTUAL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_MESSAGES_ARE_NOT_VIRTUAL;%(PreprocessorDefinitions);N = 123456789;N</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../../unittest-cpp/;../../include;../../test</AdditionalIncludeDirectories>
<UndefinePreprocessorDefinitions>
</UndefinePreprocessorDefinitions>
@ -1533,7 +1533,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_IMESSAGE_IS_NON_VIRTUAL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_IMESSAGE_IS_NON_VIRTUAL;%(PreprocessorDefinitions);N = 123456789;N</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../../unittest-cpp/;../../include;../../test</AdditionalIncludeDirectories>
<UndefinePreprocessorDefinitions>
</UndefinePreprocessorDefinitions>
@ -1559,7 +1559,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions);N = 123456789;N</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../../unittest-cpp/;../../include;../../test</AdditionalIncludeDirectories>
<UndefinePreprocessorDefinitions>
</UndefinePreprocessorDefinitions>
@ -1585,7 +1585,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions);N = 123456789;N</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../../unittest-cpp/;../../include;../../test</AdditionalIncludeDirectories>
<UndefinePreprocessorDefinitions>
</UndefinePreprocessorDefinitions>
@ -1611,7 +1611,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions);N = 123456789;N</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../../unittest-cpp/;../../include;../../test</AdditionalIncludeDirectories>
<UndefinePreprocessorDefinitions>
</UndefinePreprocessorDefinitions>
@ -1636,7 +1636,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions);N = 123456789;N</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../../unittest-cpp/;../../include;../../test</AdditionalIncludeDirectories>
<UndefinePreprocessorDefinitions>
</UndefinePreprocessorDefinitions>
@ -1661,7 +1661,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_NO_STL;ETL_FORCE_STD_INITIALIZER_LIST;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_NO_STL;ETL_FORCE_STD_INITIALIZER_LIST;%(PreprocessorDefinitions);N = 123456789;N</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../../unittest-cpp/;../../include;../../test</AdditionalIncludeDirectories>
<UndefinePreprocessorDefinitions>
</UndefinePreprocessorDefinitions>
@ -1686,7 +1686,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_NO_STL;ETL_FORCE_STD_INITIALIZER_LIST;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_NO_STL;ETL_FORCE_STD_INITIALIZER_LIST;%(PreprocessorDefinitions);N = 123456789;N</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../../unittest-cpp/;../../include;../../test</AdditionalIncludeDirectories>
<UndefinePreprocessorDefinitions>
</UndefinePreprocessorDefinitions>
@ -1711,7 +1711,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_NO_STL;ETL_FORCE_STD_INITIALIZER_LIST;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_NO_STL;ETL_FORCE_STD_INITIALIZER_LIST;%(PreprocessorDefinitions);N = 123456789;N</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../../unittest-cpp/;../../include;../../test</AdditionalIncludeDirectories>
<UndefinePreprocessorDefinitions>
</UndefinePreprocessorDefinitions>
@ -1737,7 +1737,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_NO_STL;ETL_FORCE_STD_INITIALIZER_LIST;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_NO_STL;ETL_FORCE_STD_INITIALIZER_LIST;%(PreprocessorDefinitions);N = 123456789;N</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../../unittest-cpp/;../../include;../../test</AdditionalIncludeDirectories>
<UndefinePreprocessorDefinitions>
</UndefinePreprocessorDefinitions>
@ -1948,7 +1948,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING;ETL_NO_STL;ETL_FORCE_STD_INITIALIZER_LIST;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING;ETL_NO_STL;ETL_FORCE_STD_INITIALIZER_LIST;%(PreprocessorDefinitions);N = 123456789;N</PreprocessorDefinitions>
<AdditionalIncludeDirectories>./;../../../unittest-cpp/;../../include;../../test</AdditionalIncludeDirectories>
<UndefinePreprocessorDefinitions>
</UndefinePreprocessorDefinitions>