[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
NOKEYCHECK=True
GitOrigin-RevId: c90801457f7cbbaee97821a06a893f4146ab1b2e
diff --git a/docs/ReleaseNotes.rst b/docs/ReleaseNotes.rst
index e467959..eeacec1 100644
--- a/docs/ReleaseNotes.rst
+++ b/docs/ReleaseNotes.rst
@@ -76,6 +76,8 @@
the C library.
- Implemented ``<memory_resource>`` header from C++17
- `D122780 <https://reviews.llvm.org/D122780>`_ Improved the performance of std::sort
+- The ``ranges`` versions of ``copy``, ``move``, ``copy_backward`` and ``move_backward`` are now also optimized for
+ ``std::deque<>::iterator``, which can lead to up to 20x performance improvements on certain algorithms.
Deprecations and Removals
-------------------------