mirror of
https://github.com/ETLCPP/etl.git
synced 2026-06-29 13:58:44 +08:00
Merge branch 'hotfix/alternate_stl_copy_return_value' into development
# Conflicts: # include/etl/stl/alternate/algorithm.h
This commit is contained in:
commit
ca59d506cd
@ -73,7 +73,11 @@ namespace ETLSTD
|
||||
copy(TIterator1 sb, TIterator1 se, TIterator2 db)
|
||||
{
|
||||
typedef typename ETLSTD::iterator_traits<TIterator1>::value_type value_t;
|
||||
return TIterator2(memcpy(db, sb, sizeof(value_t) * (se - sb)) + (se - sb));
|
||||
typedef typename ETLSTD::iterator_traits<TIterator1>::difference_type difference_t;
|
||||
|
||||
difference_t count = (se - sb);
|
||||
|
||||
return TIterator2(memcpy(db, sb, sizeof(value_t) * count)) + count;
|
||||
}
|
||||
|
||||
// Other iterator
|
||||
@ -102,7 +106,7 @@ namespace ETLSTD
|
||||
{
|
||||
typedef typename ETLSTD::iterator_traits<TIterator1>::value_type value_t;
|
||||
|
||||
return TIterator2(memcpy(db, sb, sizeof(value_t) * count));
|
||||
return TIterator2(memcpy(db, sb, sizeof(value_t) * count)) + count;
|
||||
}
|
||||
|
||||
// Other iterator
|
||||
|
||||
@ -39,7 +39,7 @@ SOFTWARE.
|
||||
|
||||
#define ETL_VERSION_MAJOR 14
|
||||
#define ETL_VERSION_MINOR 37
|
||||
#define ETL_VERSION_PATCH 0
|
||||
#define ETL_VERSION_PATCH 1
|
||||
|
||||
#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)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "Embedded Template Library",
|
||||
"version": "14.37.0",
|
||||
"version": "14.37.1",
|
||||
"authors": {
|
||||
"name": "John Wellbelove",
|
||||
"email": "<john.wellbelove@etlcpp.com>"
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
name=Embedded Template Library
|
||||
version=14.37.0
|
||||
version=14.37.1
|
||||
author= John Wellbelove <john.wellbelove@etlcpp.com>
|
||||
maintainer=John Wellbelove <john.wellbelove@etlcpp.com>
|
||||
license=MIT
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
===============================================================================
|
||||
14.37.1
|
||||
Fix to the return value of alternate STL 'copy'
|
||||
|
||||
===============================================================================
|
||||
14.37.0
|
||||
Added etl::indirect_vector
|
||||
|
||||
@ -166,8 +166,15 @@ namespace
|
||||
int data1[10];
|
||||
int data2[10];
|
||||
|
||||
std::copy(std::begin(dataA), std::end(dataA), std::begin(data1));
|
||||
etlstd::copy(std::begin(dataA), std::end(dataA), std::begin(data2));
|
||||
int* pstl = std::copy(std::begin(dataA), std::end(dataA), std::begin(data1));
|
||||
int* petl = etlstd::copy(std::begin(dataA), std::end(dataA), std::begin(data2));
|
||||
|
||||
using difference_type_t = std::iterator_traits<int*>::difference_type;
|
||||
|
||||
difference_type_t dstl = std::distance(data1, pstl);
|
||||
difference_type_t detl = std::distance(data2, petl);
|
||||
|
||||
CHECK_EQUAL(dstl, detl);
|
||||
|
||||
bool isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2));
|
||||
CHECK(isEqual);
|
||||
@ -179,8 +186,15 @@ namespace
|
||||
Data data1[10];
|
||||
Data data2[10];
|
||||
|
||||
std::copy(std::begin(dataD), std::end(dataD), std::begin(data1));
|
||||
etlstd::copy(std::begin(dataD), std::end(dataD), std::begin(data2));
|
||||
Data* pstl = std::copy(std::begin(dataD), std::end(dataD), std::begin(data1));
|
||||
Data* petl = etlstd::copy(std::begin(dataD), std::end(dataD), std::begin(data2));
|
||||
|
||||
using difference_type_t = std::iterator_traits<Data*>::difference_type;
|
||||
|
||||
difference_type_t dstl = std::distance(data1, pstl);
|
||||
difference_type_t detl = std::distance(data2, petl);
|
||||
|
||||
CHECK_EQUAL(dstl, detl);
|
||||
|
||||
bool isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2));
|
||||
CHECK(isEqual);
|
||||
@ -192,8 +206,15 @@ namespace
|
||||
List data1(dataL.size());
|
||||
List data2(dataL.size());
|
||||
|
||||
std::copy(std::begin(dataA), std::end(dataA), std::begin(data1));
|
||||
etlstd::copy(std::begin(dataA), std::end(dataA), std::begin(data2));
|
||||
List::iterator pstl = std::copy(std::begin(dataA), std::end(dataA), std::begin(data1));
|
||||
List::iterator petl = etlstd::copy(std::begin(dataA), std::end(dataA), std::begin(data2));
|
||||
|
||||
using difference_type_t = List::difference_type;
|
||||
|
||||
difference_type_t dstl = std::distance(data1.begin(), pstl);
|
||||
difference_type_t detl = std::distance(data2.begin(), petl);
|
||||
|
||||
CHECK_EQUAL(dstl, detl);
|
||||
|
||||
bool isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2));
|
||||
CHECK(isEqual);
|
||||
@ -205,8 +226,15 @@ namespace
|
||||
int data1[10];
|
||||
int data2[10];
|
||||
|
||||
std::copy_n(std::begin(dataA), 10, std::begin(data1));
|
||||
etlstd::copy_n(std::begin(dataA), 10, std::begin(data2));
|
||||
int* pstl = std::copy_n(std::begin(dataA), 10, std::begin(data1));
|
||||
int* petl = etlstd::copy_n(std::begin(dataA), 10, std::begin(data2));
|
||||
|
||||
using difference_type_t = std::iterator_traits<int*>::difference_type;
|
||||
|
||||
difference_type_t dstl = std::distance(data1, pstl);
|
||||
difference_type_t detl = std::distance(data2, petl);
|
||||
|
||||
CHECK_EQUAL(dstl, detl);
|
||||
|
||||
bool isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2));
|
||||
CHECK(isEqual);
|
||||
@ -218,8 +246,15 @@ namespace
|
||||
Data data1[10];
|
||||
Data data2[10];
|
||||
|
||||
std::copy_n(std::begin(dataD), 10, std::begin(data1));
|
||||
etlstd::copy_n(std::begin(dataD), 10, std::begin(data2));
|
||||
Data* pstl = std::copy_n(std::begin(dataD), 10, std::begin(data1));
|
||||
Data* petl = etlstd::copy_n(std::begin(dataD), 10, std::begin(data2));
|
||||
|
||||
using difference_type_t = std::iterator_traits<Data*>::difference_type;
|
||||
|
||||
difference_type_t dstl = std::distance(data1, pstl);
|
||||
difference_type_t detl = std::distance(data2, petl);
|
||||
|
||||
CHECK_EQUAL(dstl, detl);
|
||||
|
||||
bool isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2));
|
||||
CHECK(isEqual);
|
||||
@ -231,8 +266,15 @@ namespace
|
||||
List data1(dataL.size());
|
||||
List data2(dataL.size());
|
||||
|
||||
std::copy_n(std::begin(dataA), 10, std::begin(data1));
|
||||
etlstd::copy_n(std::begin(dataA), 10, std::begin(data2));
|
||||
List::iterator pstl = std::copy_n(std::begin(dataA), 10, std::begin(data1));
|
||||
List::iterator petl = etlstd::copy_n(std::begin(dataA), 10, std::begin(data2));
|
||||
|
||||
using difference_type_t = List::difference_type;
|
||||
|
||||
difference_type_t dstl = std::distance(data1.begin(), pstl);
|
||||
difference_type_t detl = std::distance(data2.begin(), petl);
|
||||
|
||||
CHECK_EQUAL(dstl, detl);
|
||||
|
||||
bool isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2));
|
||||
CHECK(isEqual);
|
||||
@ -244,8 +286,15 @@ namespace
|
||||
int data1[10];
|
||||
int data2[10];
|
||||
|
||||
std::copy_backward(std::begin(dataA), std::end(dataA), std::end(data1));
|
||||
etlstd::copy_backward(std::begin(dataA), std::end(dataA), std::end(data2));
|
||||
int* pstl = std::copy_backward(std::begin(dataA), std::end(dataA), std::end(data1));
|
||||
int* petl = etlstd::copy_backward(std::begin(dataA), std::end(dataA), std::end(data2));
|
||||
|
||||
using difference_type_t = std::iterator_traits<int*>::difference_type;
|
||||
|
||||
difference_type_t dstl = std::distance(data1, pstl);
|
||||
difference_type_t detl = std::distance(data2, petl);
|
||||
|
||||
CHECK_EQUAL(dstl, detl);
|
||||
|
||||
bool isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2));
|
||||
CHECK(isEqual);
|
||||
@ -257,8 +306,13 @@ namespace
|
||||
Data data1[10];
|
||||
Data data2[10];
|
||||
|
||||
std::copy_backward(std::begin(dataD), std::end(dataD), std::end(data1));
|
||||
etlstd::copy_backward(std::begin(dataD), std::end(dataD), std::end(data2));
|
||||
Data* pstl = std::copy_backward(std::begin(dataD), std::end(dataD), std::end(data1));
|
||||
Data* petl = etlstd::copy_backward(std::begin(dataD), std::end(dataD), std::end(data2));
|
||||
|
||||
using difference_type_t = std::iterator_traits<Data*>::difference_type;
|
||||
|
||||
difference_type_t dstl = std::distance(data1, pstl);
|
||||
difference_type_t detl = std::distance(data2, petl);
|
||||
|
||||
bool isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2));
|
||||
CHECK(isEqual);
|
||||
@ -270,8 +324,13 @@ namespace
|
||||
List data1(dataL.size());
|
||||
List data2(dataL.size());
|
||||
|
||||
std::copy_backward(std::begin(dataA), std::end(dataA), std::end(data1));
|
||||
etlstd::copy_backward(std::begin(dataA), std::end(dataA), std::end(data2));
|
||||
List::iterator pstl = copy_backward(std::begin(dataA), std::end(dataA), std::end(data1));
|
||||
List::iterator petl = etlstd::copy_backward(std::begin(dataA), std::end(dataA), std::end(data2));
|
||||
|
||||
using difference_type_t = std::iterator_traits<List::iterator>::difference_type;
|
||||
|
||||
difference_type_t dstl = std::distance(data1.begin(), pstl);
|
||||
difference_type_t detl = std::distance(data2.begin(), petl);
|
||||
|
||||
bool isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2));
|
||||
CHECK(isEqual);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user