[libc++] Unwrap reverse_iterator<reverse_iterator<Iter>> in __unwrap_iter
authorNikolas Klauser <nikolasklauser@berlin.de>
Fri, 17 Jun 2022 13:59:53 +0000 (15:59 +0200)
committerNikolas Klauser <nikolasklauser@berlin.de>
Fri, 17 Jun 2022 16:47:18 +0000 (18:47 +0200)
commitfb3477a4dab0fb75c4bac858c33e6006dcc173ea
tree2258c8edb3bc18a5ed5bb9e0a33a7aea5f22d205
parent5fb67e32f8fdcbe8d140440c6d20a5dd219dba86
[libc++] Unwrap reverse_iterator<reverse_iterator<Iter>> in __unwrap_iter

Simplify the implementation of `std::copy` and `std::move` by using `__unwrap_iter` and `__rewrap_iter` to unwrap and rewrap `reverse_iterator<reverse_iterator<Iter>>` instead of specializing `__copy_impl` and `__move_impl`.

Reviewed By: ldionne, #libc

Spies: wenlei, libcxx-commits

Differential Revision: https://reviews.llvm.org/D127049
libcxx/include/__algorithm/copy.h
libcxx/include/__algorithm/unwrap_iter.h
libcxx/include/__iterator/reverse_iterator.h
libcxx/test/libcxx/algorithms/alg.modifying.operations/copy.pass.cpp
libcxx/test/libcxx/iterators/unwrap_iter.pass.cpp [new file with mode: 0644]