[libcxx-commits] [PATCH] D80891: [libcxx] adds consistent comparison for `basic_string_view`

Christopher Di Bella via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Aug 4 08:18:55 PDT 2021


cjdb marked an inline comment as done.
cjdb added inline comments.


================
Comment at: libcxx/include/string_view:31
     constexpr bool operator!=(basic_string_view<charT, traits> x,
-                              basic_string_view<charT, traits> y) noexcept;
+                              basic_string_view<charT, traits> y) noexcept;     // C++17
     template<class charT, class traits>
----------------
mumbleskates wrote:
> As I understand it, the functions for the operators {`<`,`<=`,`>=`,`>`,`!=`} are no longer supposed to be defined in C++20, and should always be synthesized from `<=>` and `==` by the compiler. That is, if we are defining `operator<=>` we should be doing it //instead of// the five non-`==` operators. Is there another reason these symbols still need to be defined?
We still need to support pre-C++20 modes, which don't have a spaceship operator. Everything is conditionally guarded to make sure the right mode exposes the correct operators.

This is just a huge comment that exposes what we've implemented: see below for the actual implementation.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80891/new/

https://reviews.llvm.org/D80891



More information about the libcxx-commits mailing list