mirror of
https://github.com/ETLCPP/etl.git
synced 2026-10-28 18:07:10 +08:00
Removed asserts from copy_s and move_s algorithms
This commit is contained in:
parent
c26e2de7ec
commit
e60f68bad8
@ -2379,13 +2379,11 @@ namespace etl
|
||||
typedef typename etl::largest_type<s_size_type, d_size_type>::type min_size_type;
|
||||
#endif
|
||||
|
||||
s_size_type s_size = etl::distance(i_begin, i_end);
|
||||
ETL_ASSERT(s_size >= 0, ETL_ERROR(algorithm_error));
|
||||
d_size_type d_size = etl::distance(o_begin, o_end);
|
||||
ETL_ASSERT(d_size >= 0, ETL_ERROR(algorithm_error));
|
||||
min_size_type size = etl::min<min_size_type>(s_size, d_size);
|
||||
s_size_type s_size = etl::distance(i_begin, i_end);
|
||||
d_size_type d_size = etl::distance(o_begin, o_end);
|
||||
min_size_type min_size = etl::min<min_size_type>(s_size, d_size);
|
||||
|
||||
return etl::copy(i_begin, i_begin + size, o_begin);
|
||||
return etl::copy(i_begin, i_begin + min_size, o_begin);
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
@ -2552,13 +2550,11 @@ namespace etl
|
||||
using d_size_type = typename iterator_traits<TOutputIterator>::difference_type;
|
||||
using min_size_type = typename etl::common_type<s_size_type, d_size_type>::type;
|
||||
|
||||
s_size_type s_size = etl::distance(i_begin, i_end);
|
||||
ETL_ASSERT(s_size >= 0, ETL_ERROR(algorithm_error));
|
||||
d_size_type d_size = etl::distance(o_begin, o_end);
|
||||
ETL_ASSERT(d_size >= 0, ETL_ERROR(algorithm_error));
|
||||
min_size_type size = etl::min<min_size_type>(s_size, d_size);
|
||||
s_size_type s_size = etl::distance(i_begin, i_end);
|
||||
d_size_type d_size = etl::distance(o_begin, o_end);
|
||||
min_size_type min_size = etl::min<min_size_type>(s_size, d_size);
|
||||
|
||||
return etl::move(i_begin, i_begin + size, o_begin);
|
||||
return etl::move(i_begin, i_begin + min_size, o_begin);
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
@ -1420,17 +1420,6 @@ namespace
|
||||
CHECK(is_same);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(copy_s_random_iterator)
|
||||
{
|
||||
int data1[] = { 1, 2, 3, 4, 5 };
|
||||
int out1[10];
|
||||
CHECK_THROW(etl::copy_s(std::end(data1), std::begin(data1), std::begin(out1), std::end(out1)), etl::algorithm_error);
|
||||
CHECK_THROW(etl::copy_s(std::begin(data1), std::end(data1), std::end(out1), std::begin(out1)), etl::algorithm_error);
|
||||
CHECK_THROW(etl::move_s(std::end(data1), std::begin(data1), std::begin(out1), std::end(out1)), etl::algorithm_error);
|
||||
CHECK_THROW(etl::move_s(std::begin(data1), std::end(data1), std::end(out1), std::begin(out1)), etl::algorithm_error);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(copy_4_parameter_non_random_iterator)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user