[libcxx-commits] [PATCH] D114136: [libc++] Test that our algorithms never copy a user-provided comparator.

Konstantin Varlamov via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Nov 19 20:19:21 PST 2021


var-const added inline comments.


================
Comment at: libcxx/test/libcxx/algorithms/robust_against_copying_comparators.pass.cpp:170
+    (void)std::sort_heap(first, last, Less(&copies)); assert(copies == 0);
+    if (!TEST_IS_CONSTANT_EVALUATED) (void)std::stable_partition(first, last, UnaryTrue(&copies)); assert(copies == 0);
+    if (!TEST_IS_CONSTANT_EVALUATED) (void)std::stable_sort(first, last, Less(&copies)); assert(copies == 0);
----------------
Quuxplusone wrote:
> jloser wrote:
> > var-const wrote:
> > > Nit: I think LLVM style guide is 80 columns. Also, this would make the `assert` unconditional (applies below as well).
> > `libc++`  has its own `.clang-format` with a `ColumnLimit` of `120` FWIW.
> Unconditional `assert` detected by GCC buildkite, and fixed; thanks.
> Line-length ugly, but doubling the number of lines strikes me as strictly uglier, so I'm calling this fine.
> 
> `libc++` has its own `.clang-format` with a `ColumnLimit` of `120` FWIW.
Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114136



More information about the libcxx-commits mailing list