[libcxx-commits] [PATCH] D130295: [libc++] Uses operator<=> in string_view

Adrian Vogelsgesang via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Aug 1 16:22:05 PDT 2022


avogelsgesang added inline comments.


================
Comment at: libcxx/include/string_view:39
     template<class charT, class traits>
     constexpr bool operator< (basic_string_view<charT, traits> x,
                                  basic_string_view<charT, traits> y) noexcept;
----------------
`operator<` was also removed


================
Comment at: libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/types.compile.pass.cpp:24
 
+#include "test_macros.h"
+
----------------
what is this include used for?


================
Comment at: libcxx/test/std/strings/string.view/string.view.comparison/comparison.pass.cpp:62
+    for (size_t j = 0; j < v.size(); ++j) {
+      assert(testOrder(v[i], v[j], i == j ? Ordering::equivalent : i < j ? Ordering::less : Ordering::greater));
+      assert(testOrder(
----------------
factor out

```
auto expected = i == j ? Ordering::equivalent : i < j ? Ordering::less : Ordering::greater;
```

This condition seems to be duplicated for all of the following `assert`s

Or maybe even

```
auto expected = Ordering{i <=> j};
```


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