tetengo 1.8.2
A multipurpose library set
Loading...
Searching...
No Matches
double_array_iterator.hpp
Go to the documentation of this file.
1
7#if !defined(TETENGO_TRIE_DOUBLEARRAYITERATOR_HPP)
8#define TETENGO_TRIE_DOUBLEARRAYITERATOR_HPP
9
10#include <cstddef>
11#include <cstdint>
12#include <iterator>
13#include <optional>
14#include <stack>
15#include <string>
16#include <utility>
17#include <vector>
18
19#include <boost/stl_interfaces/iterator_interface.hpp>
20
21
22namespace tetengo::trie
23{
24 class storage;
25
26
31 public boost::stl_interfaces::iterator_interface<double_array_iterator, std ::forward_iterator_tag, std::int32_t>
32 {
33 public:
34 // constructors and destructor
35
42
49 double_array_iterator(const storage& storage_, std::size_t root_base_check_index);
50
51
52 // functions
53
59 [[nodiscard]] const std::int32_t& operator*() const;
60
66 [[nodiscard]] std::int32_t& operator*();
67
73 [[nodiscard]] const std::int32_t* operator->() const;
74
80 [[nodiscard]] std::int32_t* operator->();
81
91 friend bool operator==(const double_array_iterator& one, const double_array_iterator& another);
92
99
106
107
108 private:
109 // variables
110
111 const storage* m_p_storage;
112
113 std::stack<std::pair<std::size_t, std::string>, std::vector<std::pair<std::size_t, std::string>>>
114 m_base_check_index_key_stack;
115
116 std::optional<std::int32_t> m_current;
117
118
119 // functions
120
121 std::optional<std::int32_t> next();
122 };
123
124
125}
126
127
128#endif
A double array iterator.
Definition double_array_iterator.hpp:32
const std::int32_t & operator*() const
Dereferences the iterator.
const std::int32_t * operator->() const
Returns the pointer to the value.
double_array_iterator operator++(int)
Postincrements the iterator.
friend bool operator==(const double_array_iterator &one, const double_array_iterator &another)
Returns true when one iterator is equal to another.
std::int32_t * operator->()
Returns the pointer to the value.
double_array_iterator & operator++()
Increments the iterator.
double_array_iterator(const storage &storage_, std::size_t root_base_check_index)
Creates an iterator.
std::int32_t & operator*()
Dereferences the iterator.
double_array_iterator()
Creates an iterator.
A storage.
Definition storage.hpp:28
A trie library.