[libcxx-commits] [PATCH] D60724: [libc++] Make __debug_less::operator() constexpr

Eric Fiselier via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Apr 16 22:51:18 PDT 2019


EricWF accepted this revision.
EricWF added inline comments.
This revision is now accepted and ready to land.


================
Comment at: libcxx/test/libcxx/algorithms/debug_less.pass.cpp:278
+
+void test_constexpr() {
+    auto compare = ConstexprComparator{};
----------------
EricWF wrote:
> ```
> constexpr bool test_constexpr() {
>     std::less<> cmp;
>     __debug_less<std::less<> > dcmp(cmp);
>     assert(dcmp(1, 2));
>     assert(!dcmp(1, 1));
>     return true;
> }
> static_assert(test_constexpr(), "");
> ```
I think the suggested test is cleaner. No need to sprinkle constexpr on every variable.
Just have a constexpr function and invoke it in a constant expression.


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

https://reviews.llvm.org/D60724





More information about the libcxx-commits mailing list