Skip to content

Commit 8c72b93

Browse files
committed
Fix counting iterator.
1 parent 364e850 commit 8c72b93

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

include/boost/iterator/counting_iterator.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ class counting_iterator :
171171

172172
public:
173173
using reference = typename super_t::reference;
174+
using value_type = typename super_t::value_type;
174175
using difference_type = typename super_t::difference_type;
175176

176177
counting_iterator() = default;
@@ -183,6 +184,11 @@ class counting_iterator :
183184
{
184185
}
185186

187+
value_type operator[](difference_type n) const {
188+
auto ret_iter = *this;
189+
return *(ret_iter + n);
190+
}
191+
186192
private:
187193
reference dereference() const
188194
{

include/boost/iterator/iterator_facade.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,7 @@ class iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Diff
641641

642642
public:
643643
using reference = typename base_type::reference;
644+
using value_type = typename base_type::value_type;
644645
using difference_type = typename base_type::difference_type;
645646

646647
public:

0 commit comments

Comments
 (0)