[libcxx-commits] [PATCH] D100429: [libc++][ranges] Add range.cmp: equal_to, not_equal_to, less, etc.
Christopher Di Bella via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Apr 17 17:22:29 PDT 2021
cjdb added inline comments.
================
Comment at: libcxx/test/support/compare_types.h:47-48
+ friend bool operator==(equality_comparable_with_ec1 const&, explicit_operators const&) noexcept;
+ friend bool operator!=(explicit_operators const&, equality_comparable_with_ec1 const&) noexcept;
+ friend bool operator!=(equality_comparable_with_ec1 const&, explicit_operators const&) noexcept;
};
----------------
Quuxplusone wrote:
> I do wonder, in passing, (A) what `ec1` stands for, and (B) why we provide an `operator!=` here when we already have a suitable `operator==`.
> Also, in passing, none of these should be `noexcept`. (Removing that keyword in the first place would have shortened the line enough to escape the ravages of clang-format, and then we wouldn't even be looking at this code anymore.)
> (A) what ec1 stands for
**e**quality_**c**omparable1. I didn't expect people would like `equality_comparable_with_equality_comparable1`. Perhaps `control` would be a more descriptive name.
> (B) why we provide an operator!= here when we already have a suitable operator==.
Many types that predate C++20 have `operator!=`.
> Also, in passing, none of these should be `noexcept`.
`noexcept` is fine, unless you can provide a technical reason why it "shouldn't" be there.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D100429/new/
https://reviews.llvm.org/D100429
More information about the libcxx-commits
mailing list