[libc++] Refactor deque::iterator algorithm optimizations
authorNikolas Klauser <nikolasklauser@berlin.de>
Sun, 20 Nov 2022 22:16:20 +0000 (23:16 +0100)
committerNikolas Klauser <nikolasklauser@berlin.de>
Thu, 19 Jan 2023 19:11:43 +0000 (20:11 +0100)
commitc90801457f7cbbaee97821a06a893f4146ab1b2e
tree287e06228d676a2d3387abbc09114007dee92380
parent63e7e9c8756aeaa6dccd4620cba710c04e215934
[libc++] Refactor deque::iterator algorithm optimizations

This has multiple benefits:
- The optimizations are also performed for the `ranges::` versions of the algorithms
- Code duplication is reduced
- it is simpler to add this optimization for other segmented iterators,
  like `ranges::join_view::iterator`
- Algorithm code is removed from `<deque>`

Reviewed By: ldionne, huixie90, #libc

Spies: mstorsjo, sstefan1, EricWF, libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D132505
21 files changed:
libcxx/benchmarks/CMakeLists.txt
libcxx/benchmarks/deque_iterator.bench.cpp [new file with mode: 0644]
libcxx/docs/ReleaseNotes.rst
libcxx/include/CMakeLists.txt
libcxx/include/__algorithm/copy.h
libcxx/include/__algorithm/copy_backward.h
libcxx/include/__algorithm/move.h
libcxx/include/__algorithm/move_backward.h
libcxx/include/__iterator/reverse_iterator.h
libcxx/include/__iterator/segmented_iterator.h [new file with mode: 0644]
libcxx/include/deque
libcxx/include/module.modulemap.in
libcxx/test/libcxx/algorithms/specialized.algorithms/special.mem.concepts/nothrow_forward_iterator.compile.pass.cpp
libcxx/test/libcxx/algorithms/specialized.algorithms/special.mem.concepts/nothrow_forward_range.compile.pass.cpp
libcxx/test/libcxx/private_headers.verify.cpp
libcxx/test/std/algorithms/alg.modifying.operations/alg.copy/ranges.copy.pass.cpp
libcxx/test/std/algorithms/alg.modifying.operations/alg.copy/ranges.copy.segmented.pass.cpp [new file with mode: 0644]
libcxx/test/std/algorithms/alg.modifying.operations/alg.copy/ranges.copy_backward.pass.cpp
libcxx/test/std/algorithms/alg.modifying.operations/alg.move/ranges.move.pass.cpp
libcxx/test/std/algorithms/alg.modifying.operations/alg.move/ranges.move_backward.pass.cpp
libcxx/test/support/test_iterators.h