Browse Source

adjacency matrix: handle conversion warning

Michele Caini 1 year ago
parent
commit
9f7be95782
1 changed files with 8 additions and 2 deletions
  1. 8 2
      src/entt/graph/adjacency_matrix.hpp

+ 8 - 2
src/entt/graph/adjacency_matrix.hpp

@@ -20,6 +20,11 @@ template<typename It>
 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<diff_type>(pos)]; pos += offset) {}
+    }
+
 public:
     using value_type = std::pair<size_type, size_type>;
     using pointer = input_iterator_pointer<value_type>;
@@ -37,11 +42,12 @@ public:
           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;
     }