diff --git a/src/entt/graph/adjacency_matrix.hpp b/src/entt/graph/adjacency_matrix.hpp index 6ea071d8a..64a0cd08e 100644 --- a/src/entt/graph/adjacency_matrix.hpp +++ b/src/entt/graph/adjacency_matrix.hpp @@ -20,6 +20,11 @@ template class edge_iterator { using size_type = std::size_t; + void find_next() noexcept { + using diff_type = typename It::difference_type; + for(; pos != last && !it[static_cast(pos)]; pos += offset) {} + } + public: using value_type = std::pair; using pointer = input_iterator_pointer; @@ -37,11 +42,12 @@ class edge_iterator { pos{from}, last{to}, offset{step} { - for(; pos != last && !it[pos]; pos += offset) {} + find_next(); } constexpr edge_iterator &operator++() noexcept { - for(pos += offset; pos != last && !it[pos]; pos += offset) {} + pos += offset; + find_next(); return *this; }