diff --git a/libs/base/buffer_vector.hpp b/libs/base/buffer_vector.hpp index 5eb864a82..556012a83 100644 --- a/libs/base/buffer_vector.hpp +++ b/libs/base/buffer_vector.hpp @@ -451,6 +451,17 @@ bool operator>(buffer_vector const & v1, buffer_vector const & v2) { 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 +bool operator>=(buffer_vector const & v1, buffer_vector const & v2) +{ + return !(v1 < v2); +} namespace std { diff --git a/libs/indexer/succinct_trie_builder.hpp b/libs/indexer/succinct_trie_builder.hpp index 94dba6820..f068e2896 100644 --- a/libs/indexer/succinct_trie_builder.hpp +++ b/libs/indexer/succinct_trie_builder.hpp @@ -115,7 +115,7 @@ void BuildSuccinctTrie(TWriter & writer, TIter const beg, TIter const end) continue; 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)); entries.push_back(entry); entryStrings.push_back(strings::UniString(keyData, keyData + entry.GetKeySize())); diff --git a/libs/indexer/trie_builder.hpp b/libs/indexer/trie_builder.hpp index bd3e1c275..8ea33c666 100644 --- a/libs/indexer/trie_builder.hpp +++ b/libs/indexer/trie_builder.hpp @@ -214,7 +214,6 @@ void AppendValue(NodeInfo & node, Value const & value) // order so the values are supposed to be accumulated in the // sorted order and we can avoid sorting them before doing // further operations such as ValueList construction. - using namespace std::rel_ops; ASSERT(node.m_temporaryValueList.empty() || node.m_temporaryValueList.back() <= value, (node.m_temporaryValueList.size())); if (!node.m_temporaryValueList.empty() && node.m_temporaryValueList.back() == value) diff --git a/libs/search/search_index_values.hpp b/libs/search/search_index_values.hpp index c4f8ef709..340224c11 100644 --- a/libs/search/search_index_values.hpp +++ b/libs/search/search_index_values.hpp @@ -23,9 +23,7 @@ struct Uint64IndexValue explicit Uint64IndexValue(uint64_t featureId) : m_featureId(featureId) {} - bool operator<(Uint64IndexValue const & o) const { return m_featureId < o.m_featureId; } - - bool operator==(Uint64IndexValue const & o) const { return m_featureId == o.m_featureId; } + auto operator<=>(Uint64IndexValue const &) const = default; void Swap(Uint64IndexValue & o) { std::swap(m_featureId, o.m_featureId); }