| 123456789101112131415161718192021222324252627282930313233343536 |
- #pragma once
- #include "../end_aware_iterator.hpp"
- #include "traits.hpp"
- namespace iterator::recursive {
- /**
- * @class recursive_iterator_base
- * @brief A thin wrapper around end_aware_iterator for the purposes of
- * template metaprogramming.
- */
- template <typename Iterator>
- class base : public end_aware_iterator<Iterator> {
- public:
- using super = end_aware_iterator<Iterator>;
- protected:
- using recursive_category =
- std::conditional_t<is_associative<Iterator>{}, continue_layer_tag_t,
- terminal_layer_tag_t>;
- public:
- using super::super;
- base(super const & iter) : super(iter) {}
- base(super && iter) : super(std::move(iter)) {}
- protected:
- decltype(auto) get() const {
- if constexpr (is_associative<Iterator>{}) {
- return std::tie((**this).first, (**this).second);
- } else {
- return **this;
- }
- }
- };
- }
|