diff --git a/lemon/list_graph.h b/lemon/list_graph.h --- a/lemon/list_graph.h +++ b/lemon/list_graph.h @@ -751,6 +751,9 @@ /// /// This function undos the changes until the last snapshot /// created by save() or Snapshot(ListDigraph&). + /// + /// \warning This method invalidates the snapshot, i.e. repeated + /// restoring is not supported unless you call save() again. void restore() { detach(); for(std::list::iterator it = added_arcs.begin(); @@ -1550,6 +1553,9 @@ /// /// This function undos the changes until the last snapshot /// created by save() or Snapshot(ListGraph&). + /// + /// \warning This method invalidates the snapshot, i.e. repeated + /// restoring is not supported unless you call save() again. void restore() { detach(); for(std::list::iterator it = added_edges.begin(); diff --git a/test/digraph_test.cc b/test/digraph_test.cc --- a/test/digraph_test.cc +++ b/test/digraph_test.cc @@ -286,6 +286,14 @@ G.addArc(G.addNode(), G.addNode()); snapshot.restore(); + snapshot.save(G); + + checkGraphNodeList(G, 4); + checkGraphArcList(G, 4); + + G.addArc(G.addNode(), G.addNode()); + + snapshot.restore(); checkGraphNodeList(G, 4); checkGraphArcList(G, 4); diff --git a/test/graph_test.cc b/test/graph_test.cc --- a/test/graph_test.cc +++ b/test/graph_test.cc @@ -259,6 +259,15 @@ G.addEdge(G.addNode(), G.addNode()); snapshot.restore(); + snapshot.save(G); + + checkGraphNodeList(G, 4); + checkGraphEdgeList(G, 3); + checkGraphArcList(G, 6); + + G.addEdge(G.addNode(), G.addNode()); + + snapshot.restore(); checkGraphNodeList(G, 4); checkGraphEdgeList(G, 3);