Added value_compare to lexicographical_compare call

This commit is contained in:
John Wellbelove 2025-06-24 13:19:56 +01:00
parent 62ffe81c1f
commit d458811c26
5 changed files with 12 additions and 9 deletions

View File

@ -2859,7 +2859,9 @@ namespace etl
template <typename TKey, typename TMapped, typename TKeyCompare>
bool operator <(const etl::imap<TKey, TMapped, TKeyCompare>& lhs, const etl::imap<TKey, TMapped, TKeyCompare>& rhs)
{
return etl::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
return etl::lexicographical_compare(lhs.begin(), lhs.end(),
rhs.begin(), rhs.end(),
lhs.value_comp());
}
//*************************************************************************

View File

@ -2506,7 +2506,9 @@ namespace etl
template <typename TKey, typename TMapped, typename TKeyCompare>
bool operator <(const etl::imultimap<TKey, TMapped, TKeyCompare>& lhs, const etl::imultimap<TKey, TMapped, TKeyCompare>& rhs)
{
return etl::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
return etl::lexicographical_compare(lhs.begin(), lhs.end(),
rhs.begin(), rhs.end(),
lhs.value_comp());
}
//*************************************************************************

View File

@ -2486,10 +2486,9 @@ namespace etl
template <typename TKey, typename TCompare>
bool operator <(const etl::imultiset<TKey, TCompare>& lhs, const etl::imultiset<TKey, TCompare>& rhs)
{
return ETL_OR_STD::lexicographical_compare(lhs.begin(),
lhs.end(),
rhs.begin(),
rhs.end());
return ETL_OR_STD::lexicographical_compare(lhs.begin(), lhs.end(),
rhs.begin(), rhs.end(),
etl::imultiset<TKey, TCompare>::value_compare());
}
//*************************************************************************

View File

@ -2737,7 +2737,9 @@ namespace etl
template <typename TKey, typename TCompare>
bool operator <(const etl::iset<TKey, TCompare>& lhs, const etl::iset<TKey, TCompare>& rhs)
{
return etl::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
return etl::lexicographical_compare(lhs.begin(), lhs.end(),
rhs.begin(), rhs.end(),
etl::iset<TKey, TCompare>::value_compare());
}
//*************************************************************************

View File

@ -501,8 +501,6 @@ namespace
CMap compare_data(initial_data.begin(), initial_data.end());
EMap data(initial_data.begin(), initial_data.end());
auto v = data.at("3");
CHECK(data.at(Key("0")) == compare_data.at("0"));
CHECK(data.at(Key("1")) == compare_data.at("1"));
CHECK(data.at(Key("2")) == compare_data.at("2"));