[libcxx-commits] [PATCH] D151265: [libc++] Introduce __for_each_segment and use it in copy/move

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed May 24 14:05:27 PDT 2023


Mordante accepted this revision.
Mordante added a comment.

LGTM, if possible I still would like benchmarks, but not a blocker.



================
Comment at: libcxx/include/__algorithm/copy.h:53
+    struct _CopySegment {
+      _OutIter& __result_;
 
----------------
philnik wrote:
> Mordante wrote:
> > I'm not too thrilled with this part of the changes. Is it possible to remove this helper struct and use a lambda instead?
> > 
> > ```
> > std::__for_each_segment(__first, __last, _CopySegment, [&__result](_Traits::__local_iterator __lfirst, _Traits::__local_iterator __llast) mutable
> > {
> >   __result_ = std::__copy<_AlgPolicy>(__lfirst, __llast, std::move(__result_)).second;
> > });
> > ```
> > If so the same for `move`.
> I would love to, but unfortunately we are in C++03 land here.
ah yes right, I missed that. Then we need to keep our lambda emulation.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151265



More information about the libcxx-commits mailing list