[QUEUED scylla next] test: mutation_test: convert internal tri-compare to std::strong_ordering

0 views
Skip to first unread message

Commit Bot

unread,
Jul 29, 2021, 3:44:33 PMJul 29
to scylla...@googlegroups.com, Avi Kivity
From: Avi Kivity <a...@scylladb.com>
Committer: Avi Kivity <a...@scylladb.com>
Branch: next

test: mutation_test: convert internal tri-compare to std::strong_ordering

Drop the temporary merge_container() overload we had to support
tri-compares that returned int.

---
diff --git a/test/boost/mutation_test.cc b/test/boost/mutation_test.cc
--- a/test/boost/mutation_test.cc
+++ b/test/boost/mutation_test.cc
@@ -2601,33 +2601,14 @@ void merge_container(
}
}

-// Temporary variant of merge_container() that accepts int as the return value of merge_func,
-// until we convert all users to std::strong_ordering.
-template <typename Container, typename OutputIt>
-void merge_container(
- Container&& a,
- Container&& b,
- OutputIt oit,
- std::function<int (const typename Container::value_type&, const typename Container::value_type&)> tri_cmp,
- std::function<typename Container::value_type(typename Container::value_type, typename Container::value_type)> merge_func) {
- return merge_container(
- std::forward<Container>(a),
- std::forward<Container>(b),
- oit,
- [tri_cmp] (const typename Container::value_type& a, const typename Container::value_type& b) {
- return tri_cmp(a, b) <=> 0;
- },
- std::move(merge_func));
-}
-
row_summary merge(const schema& schema, column_kind kind, row_summary a, row_summary b) {
row_summary merged;
merge_container(
std::move(a),
std::move(b),
std::inserter(merged, merged.end()),
- [] (const std::pair<const column_id, value_summary>& a, const std::pair<const column_id, value_summary>& b) -> int {
- return a.first - b.first;
+ [] (const std::pair<const column_id, value_summary>& a, const std::pair<const column_id, value_summary>& b) -> std::strong_ordering {
+ return a.first <=> b.first;
},
[&schema, kind] (std::pair<const column_id, value_summary> a, std::pair<const column_id, value_summary> b) {
const auto& cdef = schema.column_at(kind, a.first);

Commit Bot

unread,
Jul 29, 2021, 9:40:21 PMJul 29
to scylla...@googlegroups.com, Avi Kivity
From: Avi Kivity <a...@scylladb.com>
Committer: Avi Kivity <a...@scylladb.com>
Branch: master
Reply all
Reply to author
Forward
0 new messages