[libcxx-commits] [PATCH] D114912: [libc++] [P1614] Hidden-friend operator<=> for string_view.
Nikolas Klauser via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Dec 1 15:02:18 PST 2021
philnik added inline comments.
================
Comment at: libcxx/include/__string:334-336
+#if _LIBCPP_STD_VER > 17
+ typedef strong_ordering comparison_category;
+#endif
----------------
Am I right that you use `typedef` instead of `using` for consistency here?
================
Comment at: libcxx/include/string_view:686
+#if _LIBCPP_STD_VER > 17
+ friend _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_HIDE_FROM_ABI __comp_cat_t<_Traits, weak_ordering>
+ operator<=>(basic_string_view __lhs, basic_string_view __rhs) _NOEXCEPT {
----------------
================
Comment at: libcxx/test/std/strings/string.view/string.view.comparison/spaceship.pass.cpp:1
+//===----------------------------------------------------------------------===//
+//
----------------
Your formatting seems a bit inconsistent in this file.
================
Comment at: libcxx/test/std/strings/string.view/string.view.comparison/spaceship.pass.cpp:95-101
+struct TraitsWithCompCat : std::char_traits<char> {
+ using comparison_category = std::partial_ordering;
+};
+
+struct TraitsWithoutCompCat : std::char_traits<char> {
+ void comparison_category(); // does not denote a type
+};
----------------
> I recommend not inheriting from standard types in general.
Is there any reason this does not apply here?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114912/new/
https://reviews.llvm.org/D114912
More information about the libcxx-commits
mailing list