@@ -116,17 +116,21 @@ class dense_integer_mapt
116
116
// operator++ that skips unset values.
117
117
template <class UnderlyingIterator , class UnderlyingValue >
118
118
class iterator_templatet
119
- : public std::iterator<std::forward_iterator_tag, UnderlyingValue>
120
119
{
121
- // Type of the std::iterator support class we inherit
122
- typedef std::iterator<std::forward_iterator_tag, UnderlyingValue>
123
- base_typet;
124
120
// Type of this template instantiation
125
121
typedef iterator_templatet<UnderlyingIterator, UnderlyingValue> self_typet;
126
122
// Type of our containing \ref dense_integer_mapt
127
123
typedef dense_integer_mapt<K, V, KeyToDenseInteger> map_typet;
128
124
129
125
public:
126
+ // These types are defined such that the class is compatible with being
127
+ // treated as an STL iterator. For this to work, they must not be renamed.
128
+ using iterator_category = std::forward_iterator_tag;
129
+ using value_type = UnderlyingValue;
130
+ using difference_type = std::ptrdiff_t ;
131
+ using pointer = UnderlyingValue *;
132
+ using reference = UnderlyingValue &;
133
+
130
134
iterator_templatet (UnderlyingIterator it, const map_typet &underlying_map)
131
135
: underlying_iterator(it), underlying_map(underlying_map)
132
136
{
@@ -153,11 +157,11 @@ class dense_integer_mapt
153
157
underlying_iterator = advance (underlying_iterator);
154
158
return *this ;
155
159
}
156
- typename base_typet:: reference operator *() const
160
+ reference operator *() const
157
161
{
158
162
return *underlying_iterator;
159
163
}
160
- typename base_typet:: pointer operator ->() const
164
+ pointer operator ->() const
161
165
{
162
166
return &*underlying_iterator;
163
167
}
0 commit comments