|
|
@@ -8,10 +8,12 @@
|
|
|
#pragma once
|
|
|
|
|
|
#include <ranges>
|
|
|
-#include <string>
|
|
|
#include <tuple>
|
|
|
#include <utility>
|
|
|
|
|
|
+#include <iterator/concepts.h>
|
|
|
+#include <iterator/detail/projection_tuple.h>
|
|
|
+#include <iterator/detail/recursive_expander.h>
|
|
|
#include <iterator/end_aware_iterator.h>
|
|
|
#include <iterator/facade.h>
|
|
|
#include <iterator/forwards.h>
|
|
|
@@ -19,38 +21,6 @@
|
|
|
#include <iterator/detail/macro.h>
|
|
|
|
|
|
namespace iterator {
|
|
|
-template <typename It, typename MaxDepth, size_t N = 0,
|
|
|
- typename V = std::iter_value_t<It>>
|
|
|
-struct tuple_expander {
|
|
|
- using iterator_tuple = std::tuple<end_aware_iterator<It>>;
|
|
|
-};
|
|
|
-
|
|
|
-template <typename It, size_t N> struct tuple_expander<It, bounded<N + 1>, N> {
|
|
|
- using iterator_tuple = std::tuple<end_aware_iterator<It>>;
|
|
|
-};
|
|
|
-
|
|
|
-template <typename It, typename MaxDepth, size_t N, Range V>
|
|
|
-struct tuple_expander<It, MaxDepth, N, V> {
|
|
|
- static It & _it;
|
|
|
-
|
|
|
- using next_iterator_t = decltype(std::begin(*_it));
|
|
|
- using expand_next = tuple_expander<next_iterator_t, MaxDepth, N + 1>;
|
|
|
-
|
|
|
- using iterator_tuple = tuple_cat_t<std::tuple<end_aware_iterator<It>>,
|
|
|
- typename expand_next::iterator_tuple>;
|
|
|
-};
|
|
|
-
|
|
|
-template <typename It, typename MaxDepth, size_t N, AssocRange V>
|
|
|
-struct tuple_expander<It, MaxDepth, N, V> {
|
|
|
- static It & _it;
|
|
|
-
|
|
|
- using next_iterator_t = decltype(std::begin(_it->second));
|
|
|
- using expand_next = tuple_expander<next_iterator_t, MaxDepth, N + 1>;
|
|
|
-
|
|
|
- using iterator_tuple = tuple_cat_t<std::tuple<end_aware_iterator<It>>,
|
|
|
- typename expand_next::iterator_tuple>;
|
|
|
-};
|
|
|
-
|
|
|
template <typename Tuple, typename Indices> class recursive_iterator_base;
|
|
|
template <typename... It, size_t... Is>
|
|
|
class recursive_iterator_base<std::tuple<It...>, std::index_sequence<Is...>>
|
|
|
@@ -134,8 +104,14 @@ private:
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-template <typename It, typename MaxDepth> struct recursive_iterator_helper {
|
|
|
- using iterator_tuple = typename tuple_expander<It, MaxDepth>::iterator_tuple;
|
|
|
+template <typename It, typename MaxDepth,
|
|
|
+ typename Projs = detail::Projections<>>
|
|
|
+struct recursive_iterator_helper {
|
|
|
+ static typename detail::ProjectionExpander<It, Projs>::type const & _projs;
|
|
|
+ using Projections = decltype(detail::Projections(_projs));
|
|
|
+
|
|
|
+ using iterator_tuple =
|
|
|
+ typename detail::RecursiveExpander<It, Projections, MaxDepth>::type;
|
|
|
|
|
|
static constexpr auto extent = std::tuple_size_v<iterator_tuple>;
|
|
|
using indices = decltype(std::make_index_sequence<extent>());
|