[libcxx-commits] [PATCH] D114136: [libc++] Test that our algorithms never copy a user-provided comparator.
Joe Loser via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Nov 18 17:35:21 PST 2021
jloser added inline comments.
================
Comment at: libcxx/test/libcxx/algorithms/robust_against_copying_comparators.pass.cpp:53
+ TEST_CONSTEXPR NullaryValue& operator=(const NullaryValue&) = default;
+ TEST_CONSTEXPR decltype(nullptr) operator()() const { return nullptr; }
+};
----------------
Are you using `decltype(nullptr)` instead of `nullptr_t` because of C++03 support or something else?
================
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);
----------------
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.
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