[libcxx-commits] [PATCH] D122011: [libc++][ranges] Add implicit conversion to bool test for ranges::find{, if, if_not}

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Apr 1 22:45:34 PDT 2022


philnik added inline comments.


================
Comment at: libcxx/test/support/boolean_testable.h:22
+
+  friend constexpr BooleanTestable operator!=(const BooleanTestable& lhs, const BooleanTestable& rhs) {
+    return !(lhs == rhs);
----------------
var-const wrote:
> Do we need this class to work pre-C++20?
No, but the `operator!=` only gets implicitly generated if the return value of `operator==` is `bool`. Things only compilers know :D.


================
Comment at: libcxx/test/support/boolean_testable.h:31
+private:
+  bool value_;
+};
----------------
var-const wrote:
> Optional: `= false`?
Why? This class only has a single constructor which always sets the value. In this case I think it's more confusing than helpful.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122011



More information about the libcxx-commits mailing list