Merge branch 'master' into feature/alternative-crc-tables

This commit is contained in:
John Wellbelove 2021-03-26 18:42:21 +00:00
commit b48f84701d
53 changed files with 291 additions and 179 deletions

View File

@ -45,12 +45,12 @@ namespace etl
typedef std::memory_order memory_order;
static const etl::memory_order memory_order_relaxed = std::memory_order_relaxed;
static const etl::memory_order memory_order_consume = std::memory_order_consume;
static const etl::memory_order memory_order_acquire = std::memory_order_acquire;
static const etl::memory_order memory_order_release = std::memory_order_release;
static const etl::memory_order memory_order_acq_rel = std::memory_order_acq_rel;
static const etl::memory_order memory_order_seq_cst = std::memory_order_seq_cst;
static ETL_CONSTANT etl::memory_order memory_order_relaxed = std::memory_order_relaxed;
static ETL_CONSTANT etl::memory_order memory_order_consume = std::memory_order_consume;
static ETL_CONSTANT etl::memory_order memory_order_acquire = std::memory_order_acquire;
static ETL_CONSTANT etl::memory_order memory_order_release = std::memory_order_release;
static ETL_CONSTANT etl::memory_order memory_order_acq_rel = std::memory_order_acq_rel;
static ETL_CONSTANT etl::memory_order memory_order_seq_cst = std::memory_order_seq_cst;
template <typename T>
class atomic

View File

@ -297,8 +297,8 @@ namespace etl
{
}
static const uint_least8_t IS_TRUNCATED = etl::bit<0>::value;
static const uint_least8_t CLEAR_AFTER_USE = etl::bit<1>::value;
static ETL_CONSTANT uint_least8_t IS_TRUNCATED = etl::bit<0>::value;
static ETL_CONSTANT uint_least8_t CLEAR_AFTER_USE = etl::bit<1>::value;
size_type current_size; ///< The current number of elements in the string.
const size_type CAPACITY; ///< The maximum number of elements in the string.

View File

@ -85,7 +85,7 @@ namespace etl
struct max_value_for_nbits
{
typedef typename etl::smallest_uint_for_bits<NBITS>::type value_type;
static const value_type value = (value_type(1) << (NBITS - 1)) | max_value_for_nbits<NBITS - 1>::value;
static ETL_CONSTANT value_type value = (value_type(1) << (NBITS - 1)) | max_value_for_nbits<NBITS - 1>::value;
};
/// Specialisation for when NBITS == 0.
@ -93,7 +93,7 @@ namespace etl
struct max_value_for_nbits<0>
{
typedef etl::smallest_uint_for_bits<0>::type value_type;
static const value_type value = 0;
static ETL_CONSTANT value_type value = 0;
};
template <const size_t NBITS>
@ -357,7 +357,7 @@ namespace etl
struct bit
{
typedef typename etl::smallest_uint_for_bits<POSITION + 1>::type value_type;
static const value_type value = value_type(1) << POSITION;
static ETL_CONSTANT value_type value = value_type(1) << POSITION;
};
template <const size_t POSITION>

View File

@ -137,10 +137,10 @@ namespace etl
public:
static const element_t ALL_SET = etl::integral_limits<element_t>::max;
static const element_t ALL_CLEAR = 0;
static ETL_CONSTANT element_t ALL_SET = etl::integral_limits<element_t>::max;
static ETL_CONSTANT element_t ALL_CLEAR = 0;
static const size_t BITS_PER_ELEMENT = etl::integral_limits<element_t>::bits;
static ETL_CONSTANT size_t BITS_PER_ELEMENT = etl::integral_limits<element_t>::bits;
#if ETL_CPP11_SUPPORTED
typedef etl::span<element_t> span_type;
@ -894,11 +894,11 @@ namespace etl
class bitset : public etl::ibitset
{
static const size_t ARRAY_SIZE = (MAXN % BITS_PER_ELEMENT == 0) ? MAXN / BITS_PER_ELEMENT : MAXN / BITS_PER_ELEMENT + 1;
static ETL_CONSTANT size_t ARRAY_SIZE = (MAXN % BITS_PER_ELEMENT == 0) ? MAXN / BITS_PER_ELEMENT : MAXN / BITS_PER_ELEMENT + 1;
public:
static const size_t ALLOCATED_BITS = ARRAY_SIZE * BITS_PER_ELEMENT;
static ETL_CONSTANT size_t ALLOCATED_BITS = ARRAY_SIZE * BITS_PER_ELEMENT;
public:

View File

@ -199,7 +199,7 @@ namespace etl
//*************************************************************************
/// * operator
//*************************************************************************
const_reference operator *() const
reference operator *() const
{
return picb->pbuffer[current];
}
@ -215,7 +215,7 @@ namespace etl
//*************************************************************************
/// -> operator
//*************************************************************************
const_pointer operator ->() const
pointer operator ->() const
{
return picb->pbuffer[current];
}

View File

@ -47,7 +47,7 @@ namespace etl
typedef T value_type;
static const T value = VALUE;
static ETL_CONSTANT T value = VALUE;
};
template <typename T, const T VALUE>

View File

@ -114,16 +114,16 @@ namespace etl
typedef typename etl::conditional<etl::is_signed<T>::value, int32_t, uint32_t>::type scale_t;
typedef typename etl::conditional<etl::is_signed<T>::value, int32_t, uint32_t>::type sample_t;
static const sample_t SAMPLES = static_cast<sample_t>(SAMPLE_SIZE_);
static const scale_t SCALE = static_cast<scale_t>(SCALING_);
static ETL_CONSTANT sample_t SAMPLES = static_cast<sample_t>(SAMPLE_SIZE_);
static ETL_CONSTANT scale_t SCALE = static_cast<scale_t>(SCALING_);
public:
typedef T value_type;
typedef private_cumulative_moving_average::add_insert_iterator<this_t> add_insert_iterator;
static const size_t SAMPLE_SIZE = SAMPLE_SIZE_; ///< The number of samples averaged over.
static const size_t SCALING = SCALING_; ///< The sample scaling factor.
static ETL_CONSTANT size_t SAMPLE_SIZE = SAMPLE_SIZE_; ///< The number of samples averaged over.
static ETL_CONSTANT size_t SCALING = SCALING_; ///< The sample scaling factor.
//*************************************************************************
/// Constructor
@ -191,14 +191,14 @@ namespace etl
typedef typename etl::conditional<etl::is_signed<T>::value, int32_t, uint32_t>::type scale_t;
typedef typename etl::conditional<etl::is_signed<T>::value, int32_t, uint32_t>::type sample_t;
static const scale_t SCALE = static_cast<scale_t>(SCALING_);
static ETL_CONSTANT scale_t SCALE = static_cast<scale_t>(SCALING_);
public:
typedef T value_type;
typedef private_cumulative_moving_average::add_insert_iterator<this_t> add_insert_iterator;
static const size_t SCALING = SCALING_; ///< The sample scaling factor.
static ETL_CONSTANT size_t SCALING = SCALING_; ///< The sample scaling factor.
//*************************************************************************
/// Constructor
@ -279,7 +279,7 @@ namespace etl
typedef T value_type;
typedef private_cumulative_moving_average::add_insert_iterator<this_t> add_insert_iterator;
static const size_t SAMPLE_SIZE = SAMPLE_SIZE_;
static ETL_CONSTANT size_t SAMPLE_SIZE = SAMPLE_SIZE_;
//*************************************************************************
/// Constructor

View File

@ -52,6 +52,7 @@ Original publication: https://www.codeproject.com/Articles/1170503/The-Impossibl
#include "error_handler.h"
#include "exception.h"
#include "type_traits.h"
#include "utility.h"
#if ETL_CPP11_NOT_SUPPORTED
#if !defined(ETL_IN_UNIT_TEST)
@ -198,7 +199,7 @@ namespace etl
{
ETL_ASSERT(is_valid(), ETL_ERROR(delegate_uninitialised));
return (*invocation.stub)(invocation.object, args...);
return (*invocation.stub)(invocation.object, etl::forward<TParams>(args)...);
}
//*************************************************************************
@ -315,7 +316,7 @@ namespace etl
static TReturn method_stub(void* object, TParams... params)
{
T* p = static_cast<T*>(object);
return (p->*Method)(params...);
return (p->*Method)(etl::forward<TParams>(params)...);
}
//*************************************************************************
@ -325,7 +326,7 @@ namespace etl
static TReturn const_method_stub(void* object, TParams... params)
{
T* const p = static_cast<T*>(object);
return (p->*Method)(params...);
return (p->*Method)(etl::forward<TParams>(params)...);
}
//*************************************************************************
@ -334,7 +335,7 @@ namespace etl
template <typename T, T& Instance, TReturn(T::*Method)(TParams...)>
static TReturn method_instance_stub(void*, TParams... params)
{
return (Instance.*Method)(params...);
return (Instance.*Method)(etl::forward<TParams>(params)...);
}
//*************************************************************************
@ -343,7 +344,7 @@ namespace etl
template <typename T, const T& Instance, TReturn(T::*Method)(TParams...) const>
static TReturn const_method_instance_stub(void*, TParams... params)
{
return (Instance.*Method)(params...);
return (Instance.*Method)(etl::forward<TParams>(params)...);
}
#if !defined(ETL_COMPILER_GCC)
@ -353,7 +354,7 @@ namespace etl
template <typename T, T& Instance>
static TReturn operator_instance_stub(void*, TParams... params)
{
return Instance.operator()(params...);
return Instance.operator()(etl::forward<TParams>(params)...);
}
#endif
@ -363,7 +364,7 @@ namespace etl
template <TReturn(*Method)(TParams...)>
static TReturn function_stub(void*, TParams... params)
{
return (Method)(params...);
return (Method)(etl::forward<TParams>(params)...);
}
//*************************************************************************
@ -373,7 +374,7 @@ namespace etl
static TReturn lambda_stub(void* object, TParams... arg)
{
TLambda* p = static_cast<TLambda*>(object);
return (p->operator())(arg...);
return (p->operator())(etl::forward<TParams>(arg)...);
}
//*************************************************************************

View File

@ -363,7 +363,7 @@ namespace etl
}
//***************************************************
const_reference operator *() const
reference operator *() const
{
return p_buffer[index];
}
@ -375,7 +375,7 @@ namespace etl
}
//***************************************************
const_pointer operator ->() const
pointer operator ->() const
{
return &p_buffer[index];
}
@ -624,8 +624,6 @@ namespace etl
return &p_buffer[index];
}
//***************************************************
friend const_iterator operator +(const const_iterator& lhs, difference_type offset)
{

View File

@ -63,7 +63,7 @@ namespace etl
static ETL_CONSTANT value_type ALL_SET = etl::integral_limits<value_type>::max & MASK;
static ETL_CONSTANT value_type ALL_CLEAR = 0;
static const size_t NBITS = etl::integral_limits<value_type>::bits;
static ETL_CONSTANT size_t NBITS = etl::integral_limits<value_type>::bits;
//*************************************************************************
/// Constructor

View File

@ -897,7 +897,7 @@ namespace etl
{
public:
static const size_t MAX_SIZE = MAX_SIZE_;
static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_;
//*************************************************************************
/// Constructor.

View File

@ -800,7 +800,7 @@ namespace etl
{
public:
static const size_t MAX_SIZE = MAX_SIZE_;
static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_;
//*************************************************************************
/// Constructor.

View File

@ -752,7 +752,7 @@ namespace etl
{
public:
static const size_t MAX_SIZE = MAX_SIZE_;
static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_;
//*************************************************************************
/// Constructor.

View File

@ -837,7 +837,7 @@ namespace etl
{
public:
static const size_t MAX_SIZE = MAX_SIZE_;
static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_;
//*************************************************************************
/// Constructor.

View File

@ -75,8 +75,8 @@ namespace etl
return hash;
}
static const uint64_t OFFSET_BASIS = 0xCBF29CE484222325ull;
static const uint64_t PRIME = 0x00000100000001b3ull;
static ETL_CONSTANT uint64_t OFFSET_BASIS = 0xCBF29CE484222325ull;
static ETL_CONSTANT uint64_t PRIME = 0x00000100000001b3ull;
};
//***************************************************************************
@ -133,8 +133,8 @@ namespace etl
return hash;
}
static const uint64_t OFFSET_BASIS = 0xCBF29CE484222325ull;
static const uint64_t PRIME = 0x00000100000001b3ull;
static ETL_CONSTANT uint64_t OFFSET_BASIS = 0xCBF29CE484222325ull;
static ETL_CONSTANT uint64_t PRIME = 0x00000100000001b3ull;
};
//***************************************************************************
@ -192,8 +192,8 @@ namespace etl
return hash;
}
static const uint32_t OFFSET_BASIS = 0x811C9DC5;
static const uint32_t PRIME = 0x01000193;
static ETL_CONSTANT uint32_t OFFSET_BASIS = 0x811C9DC5;
static ETL_CONSTANT uint32_t PRIME = 0x01000193;
};
//***************************************************************************
@ -250,8 +250,8 @@ namespace etl
return hash;
}
static const uint32_t OFFSET_BASIS = 0x811C9DC5;
static const uint32_t PRIME = 0x01000193;
static ETL_CONSTANT uint32_t OFFSET_BASIS = 0x811C9DC5;
static ETL_CONSTANT uint32_t PRIME = 0x01000193;
};
//***************************************************************************

View File

@ -444,7 +444,7 @@ namespace etl
return iforward_list::data_cast(p_node)->value;
}
const_reference operator *() const
reference operator *() const
{
return iforward_list::data_cast(p_node)->value;
}
@ -454,7 +454,7 @@ namespace etl
return &(iforward_list::data_cast(p_node)->value);
}
const_pointer operator &() const
pointer operator &() const
{
return &(iforward_list::data_cast(p_node)->value);
}
@ -464,7 +464,7 @@ namespace etl
return &(iforward_list::data_cast(p_node)->value);
}
const_pointer operator ->() const
pointer operator ->() const
{
return &(iforward_list::data_cast(p_node)->value);
}
@ -1621,7 +1621,7 @@ namespace etl
ETL_STATIC_ASSERT((MAX_SIZE_ > 0U), "Zero capacity etl::forward_list is not valid");
static const size_t MAX_SIZE = MAX_SIZE_;
static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_;
public:

View File

@ -320,9 +320,9 @@ namespace etl
private:
// Determines the index of the best unsigned type for the required number of bits.
static const int TYPE_INDEX = ((NBITS > 8) ? 1 : 0) +
((NBITS > 16) ? 1 : 0) +
((NBITS > 32) ? 1 : 0);
static ETL_CONSTANT int TYPE_INDEX = ((NBITS > 8) ? 1 : 0) +
((NBITS > 16) ? 1 : 0) +
((NBITS > 32) ? 1 : 0);
public:
@ -346,9 +346,9 @@ namespace etl
private:
// Determines the index of the best unsigned type for the required number of bits.
static const int TYPE_INDEX = ((NBITS > 8) ? 1 : 0) +
((NBITS > 16) ? 1 : 0) +
((NBITS > 32) ? 1 : 0);
static ETL_CONSTANT int TYPE_INDEX = ((NBITS > 8) ? 1 : 0) +
((NBITS > 16) ? 1 : 0) +
((NBITS > 32) ? 1 : 0);
public:
@ -372,9 +372,9 @@ namespace etl
private:
// Determines the index of the best unsigned type for the required value.
static const int TYPE_INDEX = ((VALUE > UINT_LEAST8_MAX) ? 1 : 0) +
((VALUE > UINT16_MAX) ? 1 : 0) +
((VALUE > UINT32_MAX) ? 1 : 0);
static ETL_CONSTANT int TYPE_INDEX = ((VALUE > UINT_LEAST8_MAX) ? 1 : 0) +
((VALUE > UINT16_MAX) ? 1 : 0) +
((VALUE > UINT32_MAX) ? 1 : 0);
public:
@ -398,9 +398,9 @@ namespace etl
private:
// Determines the index of the best signed type for the required value.
static const int TYPE_INDEX = (((VALUE > intmax_t(INT_LEAST8_MAX)) || (VALUE < intmax_t(INT_LEAST8_MIN))) ? 1 : 0) +
(((VALUE > intmax_t(INT16_MAX)) || (VALUE < intmax_t(INT16_MIN))) ? 1 : 0) +
(((VALUE > intmax_t(INT32_MAX)) || (VALUE < intmax_t(INT32_MIN))) ? 1 : 0);
static ETL_CONSTANT int TYPE_INDEX = (((VALUE > intmax_t(INT_LEAST8_MAX)) || (VALUE < intmax_t(INT_LEAST8_MIN))) ? 1 : 0) +
(((VALUE > intmax_t(INT16_MAX)) || (VALUE < intmax_t(INT16_MIN))) ? 1 : 0) +
(((VALUE > intmax_t(INT32_MAX)) || (VALUE < intmax_t(INT32_MIN))) ? 1 : 0);
public:

View File

@ -187,7 +187,7 @@ namespace etl
///< The memory for the pool of objects.
typename etl::aligned_storage<sizeof(Element), etl::alignment_of<Element>::value>::type buffer[VSize];
static const uint32_t Element_Size = sizeof(Element);
static ETL_CONSTANT uint32_t Element_Size = sizeof(Element);
// Should not be copied.
generic_pool(const generic_pool&);

View File

@ -245,7 +245,7 @@ namespace etl
return **lookup_itr;
}
const_reference operator *() const
reference operator *() const
{
return **lookup_itr;
}
@ -255,7 +255,7 @@ namespace etl
return &(**lookup_itr);
}
const_pointer operator &() const
pointer operator &() const
{
return &(**lookup_itr);
}
@ -265,7 +265,7 @@ namespace etl
return &(**lookup_itr);
}
const_pointer operator ->() const
pointer operator ->() const
{
return &(**lookup_itr);
}
@ -1294,7 +1294,7 @@ namespace etl
ETL_STATIC_ASSERT((MAX_SIZE_ > 0U), "Zero capacity etl::indirect_vector is not valid");
static const size_t MAX_SIZE = MAX_SIZE_;
static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_;
//*************************************************************************
/// Constructor.

View File

@ -373,7 +373,7 @@ namespace etl
return *p_value;
}
const_reference operator *() const
reference operator *() const
{
return *p_value;
}
@ -383,7 +383,7 @@ namespace etl
return p_value;
}
const_pointer operator &() const
pointer operator &() const
{
return p_value;
}
@ -393,7 +393,7 @@ namespace etl
return p_value;
}
const_pointer operator ->() const
pointer operator ->() const
{
return p_value;
}

View File

@ -443,7 +443,7 @@ namespace etl
return *p_value;
}
const_reference operator *() const
reference operator *() const
{
return *p_value;
}
@ -453,7 +453,7 @@ namespace etl
return p_value;
}
const_pointer operator &() const
pointer operator &() const
{
return p_value;
}
@ -463,7 +463,7 @@ namespace etl
return p_value;
}
const_pointer operator ->() const
pointer operator ->() const
{
return p_value;
}

View File

@ -538,7 +538,7 @@ namespace etl
return ilist::data_cast(p_node)->value;
}
const_reference operator *() const
reference operator *() const
{
return ilist::data_cast(p_node)->value;
}
@ -548,7 +548,7 @@ namespace etl
return &(ilist::data_cast(p_node)->value);
}
const_pointer operator &() const
pointer operator &() const
{
return &(ilist::data_cast(p_node)->value);
}
@ -558,7 +558,7 @@ namespace etl
return &(ilist::data_cast(p_node)->value);
}
const_pointer operator ->() const
pointer operator ->() const
{
return &(ilist::data_cast(p_node)->value);
}
@ -2029,7 +2029,7 @@ namespace etl
ETL_STATIC_ASSERT((MAX_SIZE_ > 0U), "Zero capacity etl::list is not valid");
static const size_t MAX_SIZE = MAX_SIZE_;
static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_;
public:

View File

@ -646,7 +646,7 @@ namespace etl
return imap::data_cast(p_node)->value;
}
const_reference operator *() const
reference operator *() const
{
return imap::data_cast(p_node)->value;
}
@ -656,7 +656,7 @@ namespace etl
return &(imap::data_cast(p_node)->value);
}
const_pointer operator &() const
pointer operator &() const
{
return &(imap::data_cast(p_node)->value);
}
@ -666,7 +666,7 @@ namespace etl
return &(imap::data_cast(p_node)->value);
}
const_pointer operator ->() const
pointer operator ->() const
{
return &(imap::data_cast(p_node)->value);
}
@ -2175,7 +2175,7 @@ namespace etl
{
public:
static const size_t MAX_SIZE = MAX_SIZE_;
static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_;
//*************************************************************************
/// Default constructor.

View File

@ -804,7 +804,7 @@ namespace etl
return imultimap::data_cast(p_node)->value;
}
const_reference operator *() const
reference operator *() const
{
return imultimap::data_cast(p_node)->value;
}
@ -814,7 +814,7 @@ namespace etl
return &(imultimap::data_cast(p_node)->value);
}
const_pointer operator &() const
pointer operator &() const
{
return &(imultimap::data_cast(p_node)->value);
}
@ -824,7 +824,7 @@ namespace etl
return &(imultimap::data_cast(p_node)->value);
}
const_pointer operator ->() const
pointer operator ->() const
{
return &(imultimap::data_cast(p_node)->value);
}
@ -2037,7 +2037,7 @@ namespace etl
{
public:
static const size_t MAX_SIZE = MAX_SIZE_;
static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_;
//*************************************************************************
/// Default constructor.

View File

@ -786,7 +786,7 @@ namespace etl
return imultiset::data_cast(p_node)->value;
}
const_reference operator *() const
reference operator *() const
{
return imultiset::data_cast(p_node)->value;
}
@ -796,7 +796,7 @@ namespace etl
return &(imultiset::data_cast(p_node)->value);
}
const_pointer operator &() const
pointer operator &() const
{
return &(imultiset::data_cast(p_node)->value);
}
@ -806,7 +806,7 @@ namespace etl
return &(imultiset::data_cast(p_node)->value);
}
const_pointer operator ->() const
pointer operator ->() const
{
return &(imultiset::data_cast(p_node)->value);
}
@ -2021,7 +2021,7 @@ namespace etl
{
public:
static const size_t MAX_SIZE = MAX_SIZE_;
static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_;
//*************************************************************************
/// Default constructor.

View File

@ -226,13 +226,13 @@ namespace etl
value_type hash;
value_type seed;
static const uint8_t FULL_BLOCK = 4;
static const value_type CONSTANT1 = 0xCC9E2D51;
static const value_type CONSTANT2 = 0x1B873593;
static const value_type SHIFT1 = 15;
static const value_type SHIFT2 = 13;
static const value_type MULTIPLY = 5;
static const value_type ADD = 0xE6546B64;
static ETL_CONSTANT uint8_t FULL_BLOCK = 4;
static ETL_CONSTANT value_type CONSTANT1 = 0xCC9E2D51;
static ETL_CONSTANT value_type CONSTANT2 = 0x1B873593;
static ETL_CONSTANT value_type SHIFT1 = 15;
static ETL_CONSTANT value_type SHIFT2 = 13;
static ETL_CONSTANT value_type MULTIPLY = 5;
static ETL_CONSTANT value_type ADD = 0xE6546B64;
};
}

View File

@ -116,7 +116,7 @@ namespace etl
//*************************************************************************
void add(uint8_t value_)
{
static const uint8_t PEARSON_LOOKUP[] =
static ETL_CONSTANT uint8_t PEARSON_LOOKUP[] =
{
228, 39, 61, 95, 227, 187, 0, 197, 31, 189, 161, 222, 34, 15, 221, 246,
19, 234, 6, 50, 113, 3, 91, 63, 77, 245, 144, 2, 183, 196, 25, 226,

View File

@ -419,7 +419,7 @@ namespace etl
typedef typename TContainer::size_type size_type;
static const size_type MAX_SIZE = size_type(SIZE);
static ETL_CONSTANT size_type MAX_SIZE = size_type(SIZE);
//*************************************************************************
/// Default constructor.

View File

@ -588,7 +588,7 @@ namespace etl
ETL_STATIC_ASSERT((SIZE <= etl::integral_limits<size_type>::max), "Size too large for memory model");
static const size_type MAX_SIZE = size_type(SIZE);
static ETL_CONSTANT size_type MAX_SIZE = size_type(SIZE);
//*************************************************************************
/// Default constructor.

View File

@ -601,7 +601,7 @@ namespace etl
ETL_STATIC_ASSERT((SIZE <= etl::integral_limits<size_type>::max), "Size too large for memory model");
static const size_type MAX_SIZE = size_type(SIZE);
static ETL_CONSTANT size_type MAX_SIZE = size_type(SIZE);
//*************************************************************************
/// Default constructor.

View File

@ -474,13 +474,13 @@ namespace etl
private:
static const size_type RESERVED_SIZE = size_type(SIZE + 1);
static ETL_CONSTANT size_type RESERVED_SIZE = size_type(SIZE + 1);
public:
ETL_STATIC_ASSERT((SIZE <= (etl::integral_limits<size_type>::max - 1)), "Size too large for memory model");
static const size_type MAX_SIZE = size_type(SIZE);
static ETL_CONSTANT size_type MAX_SIZE = size_type(SIZE);
//*************************************************************************
/// Default constructor.

View File

@ -706,7 +706,7 @@ namespace etl
ETL_STATIC_ASSERT((SIZE <= etl::integral_limits<size_type>::max), "Size too large for memory model");
static const size_type MAX_SIZE = size_type(SIZE);
static ETL_CONSTANT size_type MAX_SIZE = size_type(SIZE);
//*************************************************************************
/// Default constructor.

View File

@ -763,7 +763,7 @@ namespace etl
ETL_STATIC_ASSERT((SIZE <= etl::integral_limits<size_type>::max), "Size too large for memory model");
static const size_type MAX_SIZE = size_type(SIZE);
static ETL_CONSTANT size_type MAX_SIZE = size_type(SIZE);
//*************************************************************************
/// Default constructor.

View File

@ -218,8 +218,8 @@ namespace etl
private:
static const uint32_t a = 40014;
static const uint32_t m = 2147483563;
static ETL_CONSTANT uint32_t a = 40014;
static ETL_CONSTANT uint32_t m = 2147483563;
uint32_t value;
};
@ -271,7 +271,7 @@ namespace etl
//***************************************************************************
uint32_t operator()()
{
static const uint32_t m = ((m1 > m2) ? m1 : m2);
static ETL_CONSTANT uint32_t m = ((m1 > m2) ? m1 : m2);
value1 = (a1 * value1) % m1;
value2 = (a2 * value2) % m2;
@ -294,11 +294,11 @@ namespace etl
private:
static const uint32_t a1 = 40014;
static const uint32_t m1 = 2147483563;
static ETL_CONSTANT uint32_t a1 = 40014;
static ETL_CONSTANT uint32_t m1 = 2147483563;
static const uint32_t a2 = 40692;
static const uint32_t m2 = 2147483399;
static ETL_CONSTANT uint32_t a2 = 40692;
static ETL_CONSTANT uint32_t m2 = 2147483399;
uint32_t value1;
uint32_t value2;
@ -350,7 +350,7 @@ namespace etl
//***************************************************************************
uint32_t operator()()
{
static const uint32_t polynomial = 0x80200003;
static ETL_CONSTANT uint32_t polynomial = 0x80200003;
value >>= 1;
@ -514,8 +514,8 @@ namespace etl
private:
static const uint64_t multiplier = 6364136223846793005ULL;
static const uint64_t increment = 1ULL;
static ETL_CONSTANT uint64_t multiplier = 6364136223846793005ULL;
static ETL_CONSTANT uint64_t increment = 1ULL;
uint64_t value;
};

View File

@ -223,7 +223,7 @@ namespace etl
ETL_STATIC_ASSERT((etl::is_base_of<etl::imessage, TMessage1>::value), "TMessage7 not derived from etl::imessage");
ETL_STATIC_ASSERT((etl::is_base_of<etl::imessage, TMessage1>::value), "TMessage8 not derived from etl::imessage");
static const size_t max_size = etl::largest<etl::reference_counted_message<TMessage1, TCounter>,
static ETL_CONSTANT size_t max_size = etl::largest<etl::reference_counted_message<TMessage1, TCounter>,
etl::reference_counted_message<TMessage2, TCounter>,
etl::reference_counted_message<TMessage3, TCounter>,
etl::reference_counted_message<TMessage4, TCounter>,
@ -233,7 +233,7 @@ namespace etl
etl::reference_counted_message<TMessage8, TCounter> >::size;
static const size_t max_alignment = etl::largest<etl::reference_counted_message<TMessage1, TCounter>,
static ETL_CONSTANT size_t max_alignment = etl::largest<etl::reference_counted_message<TMessage1, TCounter>,
etl::reference_counted_message<TMessage2, TCounter>,
etl::reference_counted_message<TMessage3, TCounter>,
etl::reference_counted_message<TMessage4, TCounter>,

View File

@ -183,7 +183,7 @@ namespace etl
return *(*ilookup);
}
const_reference operator *() const
reference operator *() const
{
return *(*ilookup);
}
@ -193,7 +193,7 @@ namespace etl
return etl::addressof(*(*ilookup));
}
const_pointer operator &() const
pointer operator &() const
{
return &(*(*ilookup));
}
@ -203,7 +203,7 @@ namespace etl
return etl::addressof(*(*ilookup));
}
const_pointer operator ->() const
pointer operator ->() const
{
return etl::addressof(*(*ilookup));
}
@ -923,7 +923,7 @@ namespace etl
{
public:
static const size_t MAX_SIZE = MAX_SIZE_;
static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_;
//*************************************************************************
/// Constructor.

View File

@ -156,7 +156,7 @@ namespace etl
return *(*ilookup);
}
const_reference operator *() const
reference operator *() const
{
return *(*ilookup);
}
@ -166,7 +166,7 @@ namespace etl
return etl::addressof(*(*ilookup));
}
const_pointer operator &() const
pointer operator &() const
{
return &(*(*ilookup));
}
@ -176,7 +176,7 @@ namespace etl
return etl::addressof(*(*ilookup));
}
const_pointer operator ->() const
pointer operator ->() const
{
return etl::addressof(*(*ilookup));
}
@ -826,7 +826,7 @@ namespace etl
{
public:
static const size_t MAX_SIZE = MAX_SIZE_;
static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_;
//*************************************************************************
/// Constructor.

View File

@ -173,7 +173,7 @@ namespace etl
return *(*ilookup);
}
const_reference operator *() const
reference operator *() const
{
return *(*ilookup);
}
@ -183,7 +183,7 @@ namespace etl
return etl::addressof(*(*ilookup));
}
const_pointer operator &() const
pointer operator &() const
{
return &(*(*ilookup));
}
@ -193,7 +193,7 @@ namespace etl
return etl::addressof(*(*ilookup));
}
const_pointer operator ->() const
pointer operator ->() const
{
return etl::addressof(*(*ilookup));
}
@ -807,7 +807,7 @@ namespace etl
{
public:
static const size_t MAX_SIZE = MAX_SIZE_;
static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_;
//*************************************************************************
/// Constructor.

View File

@ -175,7 +175,7 @@ namespace etl
return *(*ilookup);
}
const_reference operator *() const
reference operator *() const
{
return *(*ilookup);
}
@ -185,7 +185,7 @@ namespace etl
return etl::addressof(*(*ilookup));
}
const_pointer operator &() const
pointer operator &() const
{
return &(*(*ilookup));
}
@ -195,7 +195,7 @@ namespace etl
return etl::addressof(*(*ilookup));
}
const_pointer operator ->() const
pointer operator ->() const
{
return etl::addressof(*(*ilookup));
}
@ -791,7 +791,7 @@ namespace etl
{
public:
static const size_t MAX_SIZE = MAX_SIZE_;
static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_;
//*************************************************************************
/// Constructor.

View File

@ -624,7 +624,7 @@ namespace etl
return iset::data_cast(p_node)->value;
}
const_reference operator *() const
reference operator *() const
{
return iset::data_cast(p_node)->value;
}
@ -634,7 +634,7 @@ namespace etl
return &(iset::data_cast(p_node)->value);
}
const_pointer operator &() const
pointer operator &() const
{
return &(iset::data_cast(p_node)->value);
}
@ -644,7 +644,7 @@ namespace etl
return &(iset::data_cast(p_node)->value);
}
const_pointer operator ->() const
pointer operator ->() const
{
return &(iset::data_cast(p_node)->value);
}
@ -2101,7 +2101,7 @@ namespace etl
{
public:
static const size_t MAX_SIZE = MAX_SIZE_;
static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_;
//*************************************************************************
/// Default constructor.

View File

@ -290,9 +290,9 @@ namespace etl
private:
// Determines the index of the best unsigned type for the required number of bits.
static const int TYPE_INDEX = ((NBITS > 8) ? 1 : 0) +
((NBITS > 16) ? 1 : 0) +
((NBITS > 32) ? 1 : 0);
static ETL_CONSTANT int TYPE_INDEX = ((NBITS > 8) ? 1 : 0) +
((NBITS > 16) ? 1 : 0) +
((NBITS > 32) ? 1 : 0);
public:
@ -316,9 +316,9 @@ namespace etl
private:
// Determines the index of the best unsigned type for the required number of bits.
static const int TYPE_INDEX = ((NBITS > 8) ? 1 : 0) +
((NBITS > 16) ? 1 : 0) +
((NBITS > 32) ? 1 : 0);
static ETL_CONSTANT int TYPE_INDEX = ((NBITS > 8) ? 1 : 0) +
((NBITS > 16) ? 1 : 0) +
((NBITS > 32) ? 1 : 0);
public:
@ -342,9 +342,9 @@ namespace etl
private:
// Determines the index of the best unsigned type for the required value.
static const int TYPE_INDEX = ((VALUE > UINT_LEAST8_MAX) ? 1 : 0) +
((VALUE > UINT16_MAX) ? 1 : 0) +
((VALUE > UINT32_MAX) ? 1 : 0);
static ETL_CONSTANT int TYPE_INDEX = ((VALUE > UINT_LEAST8_MAX) ? 1 : 0) +
((VALUE > UINT16_MAX) ? 1 : 0) +
((VALUE > UINT32_MAX) ? 1 : 0);
public:
@ -368,9 +368,9 @@ namespace etl
private:
// Determines the index of the best signed type for the required value.
static const int TYPE_INDEX = (((VALUE > intmax_t(INT_LEAST8_MAX)) || (VALUE < intmax_t(INT_LEAST8_MIN))) ? 1 : 0) +
(((VALUE > intmax_t(INT16_MAX)) || (VALUE < intmax_t(INT16_MIN))) ? 1 : 0) +
(((VALUE > intmax_t(INT32_MAX)) || (VALUE < intmax_t(INT32_MIN))) ? 1 : 0);
static ETL_CONSTANT int TYPE_INDEX = (((VALUE > intmax_t(INT_LEAST8_MAX)) || (VALUE < intmax_t(INT_LEAST8_MIN))) ? 1 : 0) +
(((VALUE > intmax_t(INT16_MAX)) || (VALUE < intmax_t(INT16_MIN))) ? 1 : 0) +
(((VALUE > intmax_t(INT32_MAX)) || (VALUE < intmax_t(INT32_MIN))) ? 1 : 0);
public:

View File

@ -529,7 +529,7 @@ namespace etl
{
public:
static const size_t MAX_SIZE = SIZE;
static ETL_CONSTANT size_t MAX_SIZE = SIZE;
//*************************************************************************
/// Default constructor.

View File

@ -63,7 +63,7 @@ namespace etl
typedef istring::value_type value_type;
static const size_t MAX_SIZE = MAX_SIZE_;
static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_;
//*************************************************************************
/// Constructor.

View File

@ -253,7 +253,7 @@ namespace etl
}
//*********************************
const_reference operator *() const
reference operator *() const
{
return inode->key_value_pair;
}
@ -265,7 +265,7 @@ namespace etl
}
//*********************************
const_pointer operator &() const
pointer operator &() const
{
return &(inode->key_value_pair);
}
@ -277,7 +277,7 @@ namespace etl
}
//*********************************
const_pointer operator ->() const
pointer operator ->() const
{
return &(inode->key_value_pair);
}
@ -1540,8 +1540,8 @@ namespace etl
public:
static const size_t MAX_SIZE = MAX_SIZE_;
static const size_t MAX_BUCKETS = MAX_BUCKETS_;
static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_;
static ETL_CONSTANT size_t MAX_BUCKETS = MAX_BUCKETS_;
//*************************************************************************
/// Default constructor.

View File

@ -251,7 +251,7 @@ namespace etl
}
//*********************************
const_reference operator *() const
reference operator *() const
{
return inode->key_value_pair;
}
@ -263,7 +263,7 @@ namespace etl
}
//*********************************
const_pointer operator &() const
pointer operator &() const
{
return &(inode->key_value_pair);
}
@ -275,7 +275,7 @@ namespace etl
}
//*********************************
const_pointer operator ->() const
pointer operator ->() const
{
return &(inode->key_value_pair);
}
@ -1446,8 +1446,8 @@ namespace etl
public:
static const size_t MAX_SIZE = MAX_SIZE_;
static const size_t MAX_BUCKETS = MAX_BUCKETS_;
static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_;
static ETL_CONSTANT size_t MAX_BUCKETS = MAX_BUCKETS_;
//*************************************************************************
/// Default constructor.

View File

@ -248,7 +248,7 @@ namespace etl
}
//*********************************
const_reference operator *() const
reference operator *() const
{
return inode->key;
}
@ -260,7 +260,7 @@ namespace etl
}
//*********************************
const_pointer operator &() const
pointer operator &() const
{
return &(inode->key);
}
@ -272,7 +272,7 @@ namespace etl
}
//*********************************
const_pointer operator ->() const
pointer operator ->() const
{
return &(inode->key);
}
@ -1430,8 +1430,8 @@ namespace etl
public:
static const size_t MAX_SIZE = MAX_SIZE_;
static const size_t MAX_BUCKETS = MAX_BUCKETS_;
static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_;
static ETL_CONSTANT size_t MAX_BUCKETS = MAX_BUCKETS_;
//*************************************************************************

View File

@ -249,7 +249,7 @@ namespace etl
}
//*********************************
const_reference operator *() const
reference operator *() const
{
return inode->key;
}
@ -261,7 +261,7 @@ namespace etl
}
//*********************************
const_pointer operator &() const
pointer operator &() const
{
return &(inode->key);
}
@ -273,7 +273,7 @@ namespace etl
}
//*********************************
const_pointer operator ->() const
pointer operator ->() const
{
return &(inode->key);
}
@ -1430,8 +1430,8 @@ namespace etl
public:
static const size_t MAX_SIZE = MAX_SIZE_;
static const size_t MAX_BUCKETS = MAX_BUCKETS_;
static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_;
static ETL_CONSTANT size_t MAX_BUCKETS = MAX_BUCKETS_;
//*************************************************************************
/// Default constructor.

View File

@ -38,8 +38,8 @@ SOFTWARE.
///\ingroup utilities
#define ETL_VERSION_MAJOR 20
#define ETL_VERSION_MINOR 6
#define ETL_VERSION_PATCH 3
#define ETL_VERSION_MINOR 7
#define ETL_VERSION_PATCH 0
#define ETL_VERSION ETL_STRINGIFY(ETL_VERSION_MAJOR) "." ETL_STRINGIFY(ETL_VERSION_MINOR) "." ETL_STRINGIFY(ETL_VERSION_PATCH)
#define ETL_VERSION_W ETL_STRINGIFY(ETL_VERSION_MAJOR) L"." ETL_STRINGIFY(ETL_VERSION_MINOR) L"." ETL_STRINGIFY(ETL_VERSION_PATCH)
#define ETL_VERSION_U16 ETL_STRINGIFY(ETL_VERSION_MAJOR) u"." ETL_STRINGIFY(ETL_VERSION_MINOR) u"." ETL_STRINGIFY(ETL_VERSION_PATCH)

View File

@ -1,6 +1,6 @@
{
"name": "ETL Embedded Template Library",
"version": "20.6.3",
"version": "20.7.0",
"author s": {
"name": "John Wellbelove",
"email": "john.wellbelove@etlcpp.com"

View File

@ -1,5 +1,5 @@
name=Embedded Template Library ETL
version=20.6.3
version=20.7.0
author= John Wellbelove <john.wellbelove@etlcpp.com>
maintainer=John Wellbelove <john.wellbelove@etlcpp.com>
license=MIT

View File

@ -1,3 +1,10 @@
===============================================================================
20.7.0
Added etl::selection_sort.
etl::delegate accepts moveable parameters.
Fixed the return type of const iterators for containers from const_iterator to iterator.
Changed many instances of 'static const' to 'static ETL_CONSTANT'.
===============================================================================
20.6.3
Updates to unit test CMake files.

View File

@ -46,6 +46,20 @@ namespace
int d;
};
//*****************************************************************************
// Test moveable only data structure.
//*****************************************************************************
struct MoveableOnlyData
{
MoveableOnlyData() = default;
~MoveableOnlyData() = default;
MoveableOnlyData(const MoveableOnlyData&) = delete;
MoveableOnlyData& operator=(const MoveableOnlyData&) = delete;
MoveableOnlyData(MoveableOnlyData&&) = default;
MoveableOnlyData& operator=(MoveableOnlyData&&) = default;
int d;
};
//*****************************************************************************
// The free function taking no parameters.
//*****************************************************************************
@ -72,6 +86,15 @@ namespace
parameter_correct = (data.d == VALUE1) && (j == VALUE2);
}
//*****************************************************************************
// The free function taking a moveable only parameter.
//*****************************************************************************
void free_moveableonly(MoveableOnlyData&& data)
{
function_called = true;
parameter_correct = (data.d == VALUE1);
}
//*****************************************************************************
// The test class with member functions.
//*****************************************************************************
@ -119,6 +142,14 @@ namespace
parameter_correct = (data.d == VALUE1) && (j = VALUE2);
}
//*******************************************
// moveable only data
void member_moveableonly(MoveableOnlyData&& data)
{
function_called = true;
parameter_correct = (data.d == VALUE1);
}
//*******************************************
// static
static void member_static(const Data& data, int j)
@ -265,6 +296,34 @@ namespace
CHECK(parameter_correct);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_free_moveableonly)
{
auto d = etl::delegate<void(MoveableOnlyData&&)>::create<free_moveableonly>();
MoveableOnlyData data;
data.d = VALUE1;
d(std::move(data));
CHECK(function_called);
CHECK(parameter_correct);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_free_moveableonly_constexpr)
{
constexpr auto d = etl::delegate<void(MoveableOnlyData&&)>::create<free_moveableonly>();
MoveableOnlyData data;
data.d = VALUE1;
d(std::move(data));
CHECK(function_called);
CHECK(parameter_correct);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_lambda_int)
{
@ -553,6 +612,36 @@ namespace
CHECK(parameter_correct);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_moveableonly)
{
Test test;
auto d = etl::delegate<void(MoveableOnlyData&&)>::create<Test, &Test::member_moveableonly>(test);
MoveableOnlyData data;
data.d = VALUE1;
d(std::move(data));
CHECK(function_called);
CHECK(parameter_correct);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_moveableonly_constexpr)
{
static Test test;
constexpr auto d = etl::delegate<void(MoveableOnlyData&&)>::create<Test, &Test::member_moveableonly>(test);
MoveableOnlyData data;
data.d = VALUE1;
d(std::move(data));
CHECK(function_called);
CHECK(parameter_correct);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_member_static)
{

View File

@ -34,6 +34,7 @@ SOFTWARE.
#include <vector>
#include <deque>
#include <array>
#include <algorithm>
#include <iostream>
#include <numeric>
@ -1991,5 +1992,21 @@ namespace
// No compilation error.
etl::deque<int, 10> v(5, 5);
}
//*************************************************************************
TEST(test_sort)
{
std::array<int, 10> initial = { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
std::array<int, 10> result = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
etl::deque<int, 10> data(initial.begin(), initial.end());
std::sort(data.begin(), data.end());
bool is_equal = std::equal(data.begin(),
data.end(),
result.begin());
CHECK(is_equal);
}
};
}