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

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Sep 14 09:03:40 PDT 2023


ldionne requested changes to this revision.
ldionne added inline comments.
This revision now requires changes to proceed.


================
Comment at: libcxx/include/__algorithm/for_each.h:33
 
+#if _LIBCPP_STD_VER >= 20
+template <class _SegmentedIterator, class _Function>
----------------
Mordante wrote:
> ldionne wrote:
> > I am fine with only optimizing this in C++20. This is QOI and we should be pushing folks towards newer Standards.
> +1
Let's just do it for C++ >= 23 since it will require `__movable_box`, which is C++23.


================
Comment at: libcxx/test/std/algorithms/alg.nonmodifying/alg.foreach/for_each.pass.cpp:1
+//===----------------------------------------------------------------------===//
+//
----------------
Not attached: We need to add a test for `std::for_each` where we pass a function object that isn't copy-constructible. They are supposed to work. They need to be move constructible though.


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