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

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed May 24 12:43:06 PDT 2023


philnik added inline comments.


================
Comment at: libcxx/include/__algorithm/copy.h:53
+    struct _CopySegment {
+      _OutIter& __result_;
 
----------------
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.


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