Fixed C++20 deprecation warning for std::rel_ops::operator<=

Signed-off-by: Alexander Borsuk <me@alex.bio>
This commit is contained in:
Alexander Borsuk
2025-08-01 20:14:17 +02:00
committed by Konstantin Pastbin
parent 2aaf37e9ee
commit 7781528263
4 changed files with 13 additions and 5 deletions

View File

@@ -451,6 +451,17 @@ bool operator>(buffer_vector<T, N1> const & v1, buffer_vector<T, N2> const & v2)
{ {
return v2 < v1; return v2 < v1;
} }
// TODO(AB): Use <=> operator.
// Used in:
// TrieChar const * const keyData = entry.GetKeyData();
// TTrieString key(keyData, keyData + entry.GetKeySize());
// using namespace std::rel_ops; // ">=" for keys.
// CHECK_GREATER_OR_EQUAL(key, prevKey, (key, prevKey));
template <typename T, size_t N1, size_t N2>
bool operator>=(buffer_vector<T, N1> const & v1, buffer_vector<T, N2> const & v2)
{
return !(v1 < v2);
}
namespace std namespace std
{ {

View File

@@ -115,7 +115,7 @@ void BuildSuccinctTrie(TWriter & writer, TIter const beg, TIter const end)
continue; continue;
TrieChar const * const keyData = entry.GetKeyData(); TrieChar const * const keyData = entry.GetKeyData();
TTrieString key(keyData, keyData + entry.GetKeySize()); TTrieString key(keyData, keyData + entry.GetKeySize());
using namespace std::rel_ops; // ">=" for keys.
CHECK_GREATER_OR_EQUAL(key, prevKey, (key, prevKey)); CHECK_GREATER_OR_EQUAL(key, prevKey, (key, prevKey));
entries.push_back(entry); entries.push_back(entry);
entryStrings.push_back(strings::UniString(keyData, keyData + entry.GetKeySize())); entryStrings.push_back(strings::UniString(keyData, keyData + entry.GetKeySize()));

View File

@@ -214,7 +214,6 @@ void AppendValue(NodeInfo & node, Value const & value)
// order so the values are supposed to be accumulated in the // order so the values are supposed to be accumulated in the
// sorted order and we can avoid sorting them before doing // sorted order and we can avoid sorting them before doing
// further operations such as ValueList construction. // further operations such as ValueList construction.
using namespace std::rel_ops;
ASSERT(node.m_temporaryValueList.empty() || node.m_temporaryValueList.back() <= value, ASSERT(node.m_temporaryValueList.empty() || node.m_temporaryValueList.back() <= value,
(node.m_temporaryValueList.size())); (node.m_temporaryValueList.size()));
if (!node.m_temporaryValueList.empty() && node.m_temporaryValueList.back() == value) if (!node.m_temporaryValueList.empty() && node.m_temporaryValueList.back() == value)

View File

@@ -23,9 +23,7 @@ struct Uint64IndexValue
explicit Uint64IndexValue(uint64_t featureId) : m_featureId(featureId) {} explicit Uint64IndexValue(uint64_t featureId) : m_featureId(featureId) {}
bool operator<(Uint64IndexValue const & o) const { return m_featureId < o.m_featureId; } auto operator<=>(Uint64IndexValue const &) const = default;
bool operator==(Uint64IndexValue const & o) const { return m_featureId == o.m_featureId; }
void Swap(Uint64IndexValue & o) { std::swap(m_featureId, o.m_featureId); } void Swap(Uint64IndexValue & o) { std::swap(m_featureId, o.m_featureId); }