Fix wrong iteration in ListGraph snapshot (#598)
authorAlpar Juttner <alpar@cs.elte.hu>
Fri, 22 May 2015 17:38:17 +0200
changeset 99981f70097df81
parent 996 dd5b5d96b657
child 1000 d94bb1e50557
Fix wrong iteration in ListGraph snapshot (#598)
lemon/list_graph.h
     1.1 --- a/lemon/list_graph.h	Sun Aug 11 17:21:22 2013 +0200
     1.2 +++ b/lemon/list_graph.h	Fri May 22 17:38:17 2015 +0200
     1.3 @@ -582,7 +582,7 @@
     1.4            snapshot.addNode(node);
     1.5          }
     1.6          virtual void add(const std::vector<Node>& nodes) {
     1.7 -          for (int i = nodes.size() - 1; i >= 0; ++i) {
     1.8 +          for (int i = nodes.size() - 1; i >= 0; --i) {
     1.9              snapshot.addNode(nodes[i]);
    1.10            }
    1.11          }
    1.12 @@ -632,7 +632,7 @@
    1.13            snapshot.addArc(arc);
    1.14          }
    1.15          virtual void add(const std::vector<Arc>& arcs) {
    1.16 -          for (int i = arcs.size() - 1; i >= 0; ++i) {
    1.17 +          for (int i = arcs.size() - 1; i >= 0; --i) {
    1.18              snapshot.addArc(arcs[i]);
    1.19            }
    1.20          }
    1.21 @@ -1394,7 +1394,7 @@
    1.22            snapshot.addNode(node);
    1.23          }
    1.24          virtual void add(const std::vector<Node>& nodes) {
    1.25 -          for (int i = nodes.size() - 1; i >= 0; ++i) {
    1.26 +          for (int i = nodes.size() - 1; i >= 0; --i) {
    1.27              snapshot.addNode(nodes[i]);
    1.28            }
    1.29          }
    1.30 @@ -1444,7 +1444,7 @@
    1.31            snapshot.addEdge(edge);
    1.32          }
    1.33          virtual void add(const std::vector<Edge>& edges) {
    1.34 -          for (int i = edges.size() - 1; i >= 0; ++i) {
    1.35 +          for (int i = edges.size() - 1; i >= 0; --i) {
    1.36              snapshot.addEdge(edges[i]);
    1.37            }
    1.38          }