3 #include <wordring/trie/trie_heap_iterator.hpp>
7 template <
typename Container>
10 template <
typename Allocator1>
13 template <
typename Container1>
16 template <
typename Container1>
22 using typename base_type::index_type;
24 using typename base_type::container;
27 using difference_type = std::ptrdiff_t;
28 using value_type = std::uint8_t;
29 using pointer = value_type*;
30 using reference = value_type&;
31 using iterator_category = std::input_iterator_tag;
33 static constexpr std::uint16_t null_value = 256u;
41 using base_type::end_index;
51 using base_type::m_index;
69 if (m_index <= 1)
return false;
72 index_type idx = (d + m_index)->m_base;
75 if (idx <= 0)
return true;
77 if ((idx + null_value) <
limit() && (d + idx + null_value)->m_check == m_index)
return true;
82 bool operator!()
const {
return operator bool() ==
false; }
84 value_type operator*()
const {
return value(); }
86 const_trie_base_iterator operator[](value_type label)
const
88 return const_trie_base_iterator(*m_c,
at_index(label));
91 const_trie_base_iterator& operator++()
97 const_trie_base_iterator operator++(
int)
104 template <
typename String>
105 void string(String& result)
const
108 for (
auto p = *
this; 1 < p.m_index; p = p.parent()) result.push_back(*p);
109 std::reverse(std::begin(result), std::end(result));
112 const_trie_base_iterator parent()
const
132 template <
typename Container1>
133 inline bool operator==(const_trie_base_iterator<Container1>
const& lhs, const_trie_base_iterator<Container1>
const& rhs)
135 assert(lhs.m_c == rhs.m_c);
136 return lhs.m_index == rhs.m_index;
139 template <
typename Container1>
140 inline bool operator!=(const_trie_base_iterator<Container1>
const& lhs, const_trie_base_iterator<Container1>
const& rhs)
142 return !(lhs == rhs);