| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- #pragma once
- #include <cstddef>
- #include <iterator/concepts.h>
- #include <iterator/detail/projection_tuple.h>
- #include <iterator/detail/recursive_expander.h>
- #include <iterator/end_aware_iterator.h>
- #include <iterator/forwards.h>
- #include <iterator/recursive_iterator.h>
- namespace iterator {
- template <typename It, typename Projs, typename MaxDepth>
- class cascade_iterator;
- template <typename It, typename... Projs, typename MaxDepth>
- class cascade_iterator<It, detail::Projections<Projs...>, MaxDepth>
- : public recursive_iterator_helper<It, MaxDepth,
- detail::Projections<Projs...>>::type,
- public facade<
- cascade_iterator<It, detail::Projections<Projs...>, MaxDepth>> {
- public:
- using sentinel_type = sentinel_t;
- public:
- cascade_iterator() = default;
- explicit cascade_iterator(Range auto & range, Projs... projs)
- : cascade_iterator(end_aware_iterator(range), projs...) {}
- explicit cascade_iterator(Range auto & range, MaxDepth, Projs... projs)
- : cascade_iterator(end_aware_iterator(range), projs...) {}
- explicit cascade_iterator(end_aware_iterator<It> iter, MaxDepth,
- Projs... projs)
- : cascade_iterator::recursive_iterator_base(iter, projs...) {}
- explicit cascade_iterator(end_aware_iterator<It> iter, Projs... projs)
- : cascade_iterator::recursive_iterator_base(iter, projs...) {}
- template <typename Ot>
- explicit cascade_iterator(end_aware_iterator<Ot> other, Projs... projs)
- : cascade_iterator(end_aware_iterator<It>(other), projs...) {}
- template <typename Ot>
- explicit cascade_iterator(end_aware_iterator<Ot> other, MaxDepth,
- Projs... projs)
- : cascade_iterator(end_aware_iterator<It>(other), projs...) {}
- };
- template <Range R, typename... Projs>
- cascade_iterator(R, Projs...)
- -> cascade_iterator<iterator_t<R>, detail::Projections<Projs...>,
- bounded<sizeof...(Projs) + 1>>;
- template <typename It, typename... Projs>
- cascade_iterator(end_aware_iterator<It>, Projs...)
- -> cascade_iterator<It, detail::Projections<Projs...>,
- bounded<sizeof...(Projs) + 1>>;
- template <Range R, typename... Projs, size_t N>
- requires(N > sizeof...(Projs))
- cascade_iterator(R, bounded<N>, Projs...)
- -> cascade_iterator<iterator_t<R>, detail::Projections<Projs...>,
- bounded<N>>;
- template <typename It, typename... Projs, size_t N>
- requires(N > sizeof...(Projs))
- cascade_iterator(end_aware_iterator<It>, bounded<N>, Projs...)
- -> cascade_iterator<It, detail::Projections<Projs...>, bounded<N>>;
- template <Range R, typename... Projs>
- cascade_iterator(R, unbounded, Projs...)
- -> cascade_iterator<iterator_t<R>, detail::Projections<Projs...>,
- unbounded>;
- template <typename It, typename... Projs>
- cascade_iterator(end_aware_iterator<It>, unbounded, Projs...)
- -> cascade_iterator<It, detail::Projections<Projs...>, unbounded>;
- }
|