mirror of
https://github.com/ETLCPP/etl.git
synced 2026-04-30 19:09:10 +08:00
Add constexpr to array comparison operators (#1303)
* Remove AppVeyor build status badge Removed AppVeyor build status badge from README. * Update README.md * Update CONTRIBUTING.md Updated the instructions for contributing. * Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277) * Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`. * Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`. * Add constexpr to array comparison operators --------- Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com> Co-authored-by: Sergei <sergej.shirokov@gmail.com>
This commit is contained in:
parent
226117b972
commit
992348b4bb
@ -1136,7 +1136,7 @@ namespace etl
|
||||
///\return <b>true</b> if the arrays are equal, otherwise <b>false</b>
|
||||
//*************************************************************************
|
||||
template <typename T, size_t SIZE>
|
||||
bool operator ==(const etl::array<T, SIZE>& lhs, const etl::array<T, SIZE>& rhs)
|
||||
ETL_CONSTEXPR14 bool operator ==(const etl::array<T, SIZE>& lhs, const etl::array<T, SIZE>& rhs)
|
||||
{
|
||||
return etl::equal(lhs.cbegin(), lhs.cend(), rhs.cbegin());
|
||||
}
|
||||
@ -1148,7 +1148,7 @@ namespace etl
|
||||
///\return <b>true</b> if the arrays are not equal, otherwise <b>false</b>
|
||||
//*************************************************************************
|
||||
template <typename T, size_t SIZE>
|
||||
bool operator !=(const etl::array<T, SIZE>& lhs, const etl::array<T, SIZE>& rhs)
|
||||
ETL_CONSTEXPR14 bool operator !=(const etl::array<T, SIZE>& lhs, const etl::array<T, SIZE>& rhs)
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
@ -631,6 +631,16 @@ namespace
|
||||
CHECK(data1 == data2);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_equal_constexpr)
|
||||
{
|
||||
ETL_CONSTEXPR14 Data data1 = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
|
||||
ETL_CONSTEXPR14 Data data2 = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
|
||||
|
||||
ETL_CONSTEXPR14 bool result = (data1 == data2);
|
||||
CHECK(result);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_not_equal)
|
||||
{
|
||||
@ -640,6 +650,16 @@ namespace
|
||||
CHECK(data1 != data2);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_not_equal_constexpr)
|
||||
{
|
||||
ETL_CONSTEXPR14 Data data1 = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
|
||||
ETL_CONSTEXPR14 Data data2 = { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
|
||||
|
||||
ETL_CONSTEXPR14 bool result = (data1 != data2);
|
||||
CHECK(result);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_less_than)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user