mirror of
https://github.com/ETLCPP/etl.git
synced 2026-11-09 14:49:53 +08:00
Fix to alternate copy return value.
This commit is contained in:
parent
c69ca9e41d
commit
487064b864
@ -73,8 +73,9 @@ namespace ETLSTD
|
||||
copy(TIterator1 sb, TIterator1 se, TIterator2 db)
|
||||
{
|
||||
typedef typename ETLSTD::iterator_traits<TIterator1>::value_type value_t;
|
||||
typedef typename ETLSTD::iterator_traits<TIterator1>::difference_type difference_t;
|
||||
|
||||
return TIterator2(memcpy(db, sb, sizeof(value_t) * (se - sb)));
|
||||
return TIterator2(memcpy(db, sb, sizeof(value_t) * (se - sb))) + (se - sb);
|
||||
}
|
||||
|
||||
// Other iterator
|
||||
|
||||
@ -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,13 @@ 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);
|
||||
|
||||
bool isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2));
|
||||
CHECK(isEqual);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user