Skip to content

Commit 93b6c48

Browse files
eyalrozeyalroz-gehc
authored andcommitted
Made the enumerate.hpp templated code support non-struct/class underlying iterator
1 parent 14725a8 commit 93b6c48

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

examples/enumerate.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class enumerator
6969

7070
bool operator!=(iterator other) { return inner_iter != other.inner_iter; }
7171

72-
typename Container::iterator::value_type item() { return *inner_iter; }
72+
typename std::iterator_traits<typename Container::iterator>::value_type const& item() { return *inner_iter; }
7373

7474
value_type operator*() { return value_type{counter_, *inner_iter}; }
7575

@@ -95,7 +95,7 @@ class enumerator
9595

9696
bool operator!=(const_iterator other) { return inner_iter != other.inner_iter; }
9797

98-
typename Container::const_iterator::value_type item() { return *inner_iter; }
98+
typename std::iterator_traits<typename Container::const_iterator>::value_type const& item() { return *inner_iter; }
9999

100100
const_value_type operator*() { return const_value_type{counter_, *inner_iter}; }
101101

0 commit comments

Comments
 (0)