[libcxx-commits] [PATCH] D151274: [libc++] Optimize for_each for segmented iterators

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Oct 23 18:04:25 PDT 2023


ldionne added inline comments.


================
Comment at: libcxx/include/__algorithm/for_each.h:39
+  requires __is_segmented_iterator<_SegmentedIterator>::value
+_LIBCPP_HIDE_FROM_ABI constexpr _Function
+for_each(_SegmentedIterator __first, _SegmentedIterator __last, _Function __func) {
----------------
We need to test `constexpr` for segmented iterators (especially since we've had bugs related to that recently).


================
Comment at: libcxx/test/std/algorithms/alg.nonmodifying/alg.foreach/for_each.pass.cpp:75
+  // check that segmented iterators work properly
+  for (const int size : {0, 1, 2, 1023, 1024, 1025, 2047, 2048, 2049}) {
+    std::deque<int> d(size);
----------------
I think this range-based for-loop will break your C++03 CI run.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151274



More information about the libcxx-commits mailing list