forward_list_ext

This commit is contained in:
John Wellbelove 2020-11-19 12:55:03 +00:00
parent 6cb26807bc
commit 0cf882540c
3 changed files with 20 additions and 18 deletions

View File

@ -1051,7 +1051,7 @@ namespace etl
{
public:
ETL_STATIC_ASSERT((MAX_SIZE_ > 0U), "Zero sized etl::circular_buffer is not valid. Did you mean circular_buffer_ext?");
ETL_STATIC_ASSERT((MAX_SIZE_ > 0U), "Zero sized etl::circular_buffer is not valid");
static ETL_CONSTANT typename icircular_buffer<T>::size_type MAX_SIZE = typename icircular_buffer<T>::size_type(MAX_SIZE_);

View File

@ -1624,6 +1624,8 @@ namespace etl
{
public:
ETL_STATIC_ASSERT((MAX_SIZE_ > 0U), "Zero sized etl::forward_list is not valid");
static const size_t MAX_SIZE = MAX_SIZE_;
public:
@ -1748,7 +1750,7 @@ namespace etl
///\note 'merge' and 'splice_after' and are not supported.
//*************************************************************************
template <typename T>
class forward_list<T, 0> : public etl::iforward_list<T>
class forward_list_ext : public etl::iforward_list<T>
{
public:
@ -1764,7 +1766,7 @@ namespace etl
//*************************************************************************
/// Default constructor.
//*************************************************************************
forward_list()
forward_list_ext()
: etl::iforward_list<T>(true)
{
}
@ -1772,7 +1774,7 @@ namespace etl
//*************************************************************************
/// Default constructor.
//*************************************************************************
explicit forward_list(etl::ipool& node_pool)
explicit forward_list_ext(etl::ipool& node_pool)
: etl::iforward_list<T>(node_pool, node_pool.max_size(), true)
{
this->initialise();
@ -1781,7 +1783,7 @@ namespace etl
//*************************************************************************
/// Construct from size.
//*************************************************************************
explicit forward_list(size_t initial_size, etl::ipool& node_pool)
explicit forward_list_ext(size_t initial_size, etl::ipool& node_pool)
: etl::iforward_list<T>(node_pool, node_pool.max_size(), true)
{
this->assign(initial_size, T());
@ -1790,7 +1792,7 @@ namespace etl
//*************************************************************************
/// Construct from size and value.
//*************************************************************************
explicit forward_list(size_t initial_size, const T& value, etl::ipool& node_pool)
explicit forward_list_ext(size_t initial_size, const T& value, etl::ipool& node_pool)
: etl::iforward_list<T>(node_pool, node_pool.max_size(), true)
{
this->assign(initial_size, value);
@ -1799,7 +1801,7 @@ namespace etl
//*************************************************************************
/// Copy constructor. Implicit pool.
//*************************************************************************
forward_list(const forward_list& other)
forward_list_ext(const forward_list_ext& other)
: etl::iforward_list<T>(*other.p_node_pool, other.p_node_pool->max_size(), true)
{
this->assign(other.cbegin(), other.cend());
@ -1808,7 +1810,7 @@ namespace etl
//*************************************************************************
/// Copy constructor. Explicit pool.
//*************************************************************************
forward_list(const forward_list& other, etl::ipool& node_pool)
forward_list_ext(const forward_list_ext& other, etl::ipool& node_pool)
: etl::iforward_list<T>(node_pool, node_pool.max_size(), true)
{
this->assign(other.cbegin(), other.cend());
@ -1818,7 +1820,7 @@ namespace etl
//*************************************************************************
/// Move constructor. Implicit pool
//*************************************************************************
forward_list(forward_list&& other)
forward_list_ext(forward_list_ext&& other)
: etl::iforward_list<T>(*other.p_node_pool, other.p_node_pool->max_size(), true)
{
this->move_container(std::move(other));
@ -1827,7 +1829,7 @@ namespace etl
//*************************************************************************
/// Move constructor. Explicit pool
//*************************************************************************
forward_list(forward_list&& other, etl::ipool& node_pool)
forward_list_ext(forward_list_ext&& other, etl::ipool& node_pool)
: etl::iforward_list<T>(node_pool, node_pool.max_size(), true)
{
this->move_container(std::move(other));
@ -1838,7 +1840,7 @@ namespace etl
/// Construct from range.
//*************************************************************************
template <typename TIterator>
forward_list(TIterator first, TIterator last, etl::ipool& node_pool)
forward_list_ext(TIterator first, TIterator last, etl::ipool& node_pool)
: etl::iforward_list<T>(node_pool, node_pool.max_size(), true)
{
this->assign(first, last);
@ -1848,7 +1850,7 @@ namespace etl
//*************************************************************************
/// Construct from initializer_list.
//*************************************************************************
forward_list(std::initializer_list<T> init, etl::ipool& node_pool)
forward_list_ext(std::initializer_list<T> init, etl::ipool& node_pool)
: etl::iforward_list<T>(node_pool, node_pool.max_size(), true)
{
this->assign(init.begin(), init.end());
@ -1858,7 +1860,7 @@ namespace etl
//*************************************************************************
/// Destructor.
//*************************************************************************
~forward_list()
~forward_list_ext()
{
this->initialise();
}
@ -1866,7 +1868,7 @@ namespace etl
//*************************************************************************
/// Assignment operator.
//*************************************************************************
forward_list& operator = (const forward_list& rhs)
forward_list_ext& operator = (const forward_list_ext& rhs)
{
if (&rhs != this)
{
@ -1880,7 +1882,7 @@ namespace etl
//*************************************************************************
/// Move assignment operator.
//*************************************************************************
forward_list& operator = (forward_list&& rhs)
forward_list_ext& operator = (forward_list_ext&& rhs)
{
this->move_container(etl::move(rhs));

View File

@ -50,11 +50,11 @@ namespace
typedef TestDataDC<std::string> ItemDC;
typedef TestDataNDC<std::string> ItemNDC;
typedef etl::forward_list<ItemDC, 0> DataDC;
typedef etl::forward_list<ItemNDC, 0> DataNDC;
typedef etl::forward_list_ext<ItemDC> DataDC;
typedef etl::forward_list_ext<ItemNDC> DataNDC;
typedef etl::iforward_list<ItemNDC> IDataNDC;
typedef etl::forward_list<int, 0> DataInt;
typedef etl::forward_list_ext<int> DataInt;
typedef std::forward_list<ItemDC> CompareDataDC;
typedef std::forward_list<ItemNDC> CompareDataNDC;