[libc++] Refactor stride_counting_iterator
authorLouis Dionne <ldionne.2@gmail.com>
Tue, 18 Jan 2022 15:34:32 +0000 (10:34 -0500)
committerLouis Dionne <ldionne.2@gmail.com>
Tue, 18 Jan 2022 17:24:05 +0000 (12:24 -0500)
commita9bfb4c4f48d9434918374566d5780c97a805bcc
tree698913d129ca9e0b1adc9d8fe57a45af2d3be143
parentdf51be85e4aee2365338186e38aebf7ffe81fc90
[libc++] Refactor stride_counting_iterator

Instead of storing the wrapped iterator inside the stride_counting_iterator,
store its base so we can have e.g. a stride_counting_iterator of an
input_iterator (which was previously impossible because input_iterators
are not copyable). Also a few other simplifications in stride_counting_iterator.

As a fly-by fix, remove the member base() functions, which are super
confusing.

Differential Revision: https://reviews.llvm.org/D116613
libcxx/test/std/iterators/iterator.primitives/range.iter.ops/range.iter.ops.advance/iterator_sentinel.pass.cpp
libcxx/test/std/ranges/range.adaptors/range.drop/begin.pass.cpp
libcxx/test/support/test_iterators.h