[libcxx-commits] [PATCH] D150146: [libc++] Implement ranges::starts_with
Nikolas Klauser via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu May 11 15:44:26 PDT 2023
philnik accepted this revision.
philnik added a comment.
This revision is now accepted and ready to land.
LGTM % comments with green CI.
================
Comment at: libcxx/include/__algorithm/ranges_starts_with.h:12
+
+#include "ranges_mismatch.h"
+#include <__algorithm/in_in_result.h>
----------------
================
Comment at: libcxx/include/__algorithm/ranges_starts_with.h:52
+ std::move(__first1),
+ std::move(__last1),
+ std::move(__first2),
----------------
Would you be interested in optimizing random access iterators? If not, I can also do that in a follow-up patch.
================
Comment at: libcxx/test/std/algorithms/alg.nonmodifying/alg.starts_with/ranges.starts_with.pass.cpp:65
+constexpr void test_iterators() {
+ {// simply tests
+ {int a[] = {1, 2, 3, 4, 5, 6};
----------------
Please use two spaces per indentation level.
================
Comment at: libcxx/test/std/algorithms/alg.nonmodifying/alg.starts_with/ranges.starts_with.pass.cpp:217-224
+ types::for_each(types::forward_iterator_list<int*>{}, []<class I2>() {
+ types::for_each(types::forward_iterator_list<int*>{}, []<class I1>() {
+ test_iterators<I1, I1, I2, I2>();
+ test_iterators<I1, sized_sentinel<I1>, I2, I2>();
+ test_iterators<I1, I1, I2, sized_sentinel<I2>>();
+ test_iterators<I1, sized_sentinel<I1>, I2, sized_sentinel<I2>>();
+ });
----------------
================
Comment at: libcxx/test/std/algorithms/alg.nonmodifying/alg.starts_with/ranges.starts_with.pass.cpp:253-254
+ test();
+ static_assert(test());
+ return 0;
+}
----------------
================
Comment at: libcxx/test/std/algorithms/alg.nonmodifying/alg.starts_with/ranges.starts_with.pass.cpp:32
+
+template <class Iter1, class Sent1, class Iter2, class Sent2 = Iter2>
+constexpr void test_iterators() {
----------------
ZijunZhao wrote:
> philnik wrote:
> > Looks like clang-format does weird things again. Please update the formatting.
> Are there any command instructions to disable clang-format? I fixed part of the code manually 😂
You can enable and disable clang-format with `// clang-format off/on`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D150146/new/
https://reviews.llvm.org/D150146
More information about the libcxx-commits
mailing list