Fixed etl::stack top level assignment operator not clearing before copy

This commit is contained in:
John Wellbelove 2020-08-27 18:40:05 +01:00
parent 6788f2761e
commit f2d6df5944
7 changed files with 20 additions and 5 deletions

View File

@ -447,8 +447,7 @@ namespace etl
istack& operator = (istack&& rhs)
{
if (&rhs != this)
{
clear();
{
clone(etl::move(rhs));
}
@ -463,6 +462,8 @@ namespace etl
//*************************************************************************
void clone(const istack& other)
{
clear();
size_t index = 0;
for (size_t i = 0; i < other.size(); ++i)
@ -477,6 +478,8 @@ namespace etl
//*************************************************************************
void clone(istack&& other)
{
clear();
size_t index = 0;
for (size_t i = 0; i < other.size(); ++i)

View File

@ -39,7 +39,7 @@ SOFTWARE.
#define ETL_VERSION_MAJOR 18
#define ETL_VERSION_MINOR 12
#define ETL_VERSION_PATCH 5
#define ETL_VERSION_PATCH 6
#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": "Embedded Template Library",
"version": "18.12.5",
"version": "18.12.6",
"authors": {
"name": "John Wellbelove",
"email": "john.wellbelove@etlcpp.com"

View File

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

View File

@ -1,3 +1,7 @@
===============================================================================
18.12.6
Fixed etl::stack top level assignment operator not clearing before copy.
===============================================================================
18.12.5
Fixed issue for incorrect operation of erase(const_iterator, const_iterator) when

View File

@ -485,6 +485,10 @@ namespace
etl::queue<int, 4> queue2;
// These should be overwritten.
queue2.push(5);
queue2.push(6);
queue2 = queue;
CHECK(queue.size() == queue2.size());

View File

@ -437,6 +437,10 @@ namespace
etl::stack<int, 4> stack2;
// These should be overwritten.
stack2.push(5);
stack2.push(6);
stack2 = stack;
CHECK(stack.size() == stack2.size());