@@ -116,17 +116,21 @@ class dense_integer_mapt
116116 // operator++ that skips unset values.
117117 template <class UnderlyingIterator , class UnderlyingValue >
118118 class iterator_templatet
119- : public std::iterator<std::forward_iterator_tag, UnderlyingValue>
120119 {
121- // Type of the std::iterator support class we inherit
122- typedef std::iterator<std::forward_iterator_tag, UnderlyingValue>
123- base_typet;
124120 // Type of this template instantiation
125121 typedef iterator_templatet<UnderlyingIterator, UnderlyingValue> self_typet;
126122 // Type of our containing \ref dense_integer_mapt
127123 typedef dense_integer_mapt<K, V, KeyToDenseInteger> map_typet;
128124
129125 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+
130134 iterator_templatet (UnderlyingIterator it, const map_typet &underlying_map)
131135 : underlying_iterator(it), underlying_map(underlying_map)
132136 {
@@ -153,11 +157,11 @@ class dense_integer_mapt
153157 underlying_iterator = advance (underlying_iterator);
154158 return *this ;
155159 }
156- typename base_typet:: reference operator *() const
160+ reference operator *() const
157161 {
158162 return *underlying_iterator;
159163 }
160- typename base_typet:: pointer operator ->() const
164+ pointer operator ->() const
161165 {
162166 return &*underlying_iterator;
163167 }
0 commit comments