1753: Fix the pretty-printer of util::internal::graph_base.

https://svn.lrde.epita.fr/svn/oln/trunk Index: ChangeLog from Roland Levillain <roland@lrde.epita.fr> Fix the pretty-printer of util::internal::graph_base. * milena/mln/util/internal/graph_base.hh (node<void>::edges): Use a std::vector (as in node<T>), not a std::list. (util::internal::graph_base<N, E>::print_debug): Fix the iteration on the edges adjacent to a vertex. * milena/tests/core/graph_image.cc: Exercise util::internal::graph_base<N, E>::print_debug mln/util/internal/graph_base.hh | 7 +++++-- tests/core/graph_image.cc | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) Index: milena/tests/core/graph_image.cc --- milena/tests/core/graph_image.cc (revision 1753) +++ milena/tests/core/graph_image.cc (working copy) @@ -75,6 +75,7 @@ `-------*/ p_graph<point2d> pg(g); + g.print_debug(std::cout); /*-------------. | Graph image. | Index: milena/mln/util/internal/graph_base.hh --- milena/mln/util/internal/graph_base.hh (revision 1753) +++ milena/mln/util/internal/graph_base.hh (working copy) @@ -82,7 +82,7 @@ template<> struct node<void> { - std::list<edge_id> edges; + std::vector<edge_id> edges; }; @@ -386,7 +386,10 @@ n != nodes_.end (); ++n, ++i) { ostr << "node: " << i << std::endl << " -- adjacent nodes: "; - for (typename edges_t::const_iterator e = (*n)->edges.begin(); + /* FIXME: We shouldn't manipulate std::vector<edge_id> + directly, but use a typedef instead. */ + for (typename std::vector<util::edge_id>::const_iterator e = + (*n)->edges.begin(); e != (*n)->edges.end(); ++e) ostr << *e << " "; ostr << std::endl;
participants (1)
-
Roland Levillain