[libcxx-commits] [PATCH] D130295: [libc++] Uses operator<=> in string_view
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Aug 2 09:17:00 PDT 2022
ldionne accepted this revision as: ldionne.
ldionne added a comment.
LGTM, but please wait for other reviewers to be satisfied too.
My understanding is that there will be a follow-up change to switch from `common_type_t` to `__type_identity_t`, as we discussed during live review just now.
================
Comment at: libcxx/include/string_view:804-805
+ return static_cast<typename _Traits::comparison_category >(__lhs.compare(__rhs) <=> 0);
+ } else
+ return static_cast<weak_ordering>(__lhs.compare(__rhs) <=> 0);
+}
----------------
This looks really strange to me, I'd suggest using `else {...}`.
================
Comment at: libcxx/test/std/strings/string.view/string.view.comparison/comparison.verify.cpp:25
+template <class CharT, class Ordering>
+struct traits {
+ typedef CharT char_type;
----------------
It would be nice to add a non `.verify.cpp` test with `char_traits` that explicitly specify a `comparison_category` that is `weak_ordering`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D130295/new/
https://reviews.llvm.org/D130295
More information about the libcxx-commits
mailing list