Skip to content

Commit 1eb3c28

Browse files
committed
Fix constness on dereferencing a concat_iteratort
Dereferencing a `concat_iteratort` from concating const collections with `ranget` would previously introduce a compile error, due to a `const` to non-const conversion. This commit fixes this, by using the same return type as the iterator which it wraps around.
1 parent 4f9d772 commit 1eb3c28

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/util/range.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@ struct concat_iteratort
208208
public:
209209
using difference_type = typename first_iteratort::difference_type;
210210
using value_type = typename first_iteratort::value_type;
211-
using pointer = const value_type *;
212-
using reference = const value_type &;
211+
using pointer = typename first_iteratort::pointer;
212+
using reference = typename first_iteratort::reference;
213213
using iterator_category = std::forward_iterator_tag;
214214

215215
static_assert(
@@ -245,14 +245,14 @@ struct concat_iteratort
245245
return tmp;
246246
}
247247

248-
value_type &operator*()
248+
reference operator*()
249249
{
250250
if(first_begin == first_end)
251251
return *second_begin;
252252
return *first_begin;
253253
}
254254

255-
value_type *operator->()
255+
pointer operator->()
256256
{
257257
if(first_begin == first_end)
258258
return &(*second_begin);

0 commit comments

Comments
 (0)