[libcxx-commits] [PATCH] D129039: [libc++] Use __unwrap_iter_impl for both unwrapping and rewrapping

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jul 11 16:02:11 PDT 2022


philnik added a comment.

I've thought about this some more and came to the conclusion that we shouldn't try to make `__rewrap_iter` move-only-iterator-friendly. The only places we use that is in `copy`, `copy_backward`, `move` and `move_backward`. I think the best way to handle this is to forward all these algorithms to `copy` and unwrap and rewrap everything there. This means that we can unwrap iterators better in all these algorithms and we only have to have the complicated code in one place. The way to forward them all would be to use `reverse_iterator` for the `_backward` algorithms and `move_iterator` for the `move` algorihtms. The correct way to unwrap to a `memcpy` would then be to check the return type of `*iter` and based on that check whether `is_trivially_copy_constructible` or `is_trivially_move_constructible` is true. (Forwarding to `memcpy` with a `move_iterator` passed to `copy` might actually be a bug currently)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129039



More information about the libcxx-commits mailing list