|
Boost Users : |
From: Jeremy Siek (jsiek_at_[hidden])
Date: 2002-09-15 21:38:25
What you are doing looks right. So there's probably a bug somewhere...
On Sun, 15 Sep 2002 yg-boost-users_at_[hidden] wrote:
yg-boo> Hello,
yg-boo>
yg-boo> Q: one can construct a graph using adjacency_list<> and then immediately
yg-boo> iterate over the vertices, right?
yg-boo>
yg-boo> The program below writes out the numbers 0 to 9 when compiled using
yg-boo> gcc 3.2 on linux. Ditto on my IRIX system, *unless* I try to
yg-boo> optimize. I expect this is a GCC optimizer bug, but I just want to be
yg-boo> sure I haven't overlooked something in the boost docs.
yg-boo>
yg-boo> Thanks,
yg-boo> -S
yg-boo>
yg-boo>
yg-boo> #include <iostream>
yg-boo>
yg-boo> #include <boost/graph/graph_traits.hpp>
yg-boo> #include <boost/graph/adjacency_list.hpp>
yg-boo>
yg-boo>
yg-boo> typedef boost::adjacency_list< boost::vecS, boost::vecS,
yg-boo> boost::undirectedS,
yg-boo> boost::no_property,
yg-boo> boost::property<boost::edge_weight_t,float>
yg-boo> > Graph;
yg-boo>
yg-boo> typedef boost::graph_traits<Graph>::vertex_descriptor vertex_descriptor;
yg-boo> typedef boost::graph_traits<Graph>::edge_descriptor edge_descriptor;
yg-boo>
yg-boo>
yg-boo>
yg-boo> int main()
yg-boo> {
yg-boo> Graph g( 10 );
yg-boo> boost::graph_traits<Graph>::vertex_iterator ui, ui_end;
yg-boo>
yg-boo> for (boost::tie(ui, ui_end) = boost::vertices(g); ui != ui_end; ++ui) {
yg-boo> std::cout << "*ui = " << *ui << std::endl;
yg-boo> }
yg-boo>
yg-boo> return 0;
yg-boo> }
yg-boo>
yg-boo>
yg-boo>
yg-boo>
yg-boo>
yg-boo> Info: <http://www.boost.org>
yg-boo> Wiki: <http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl>
yg-boo> Unsubscribe: <mailto:boost-users-unsubscribe_at_[hidden]>
yg-boo>
yg-boo>
yg-boo> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
yg-boo>
yg-boo>
----------------------------------------------------------------------
Jeremy Siek http://php.indiana.edu/~jsiek/
Ph.D. Student, Indiana Univ. B'ton email: jsiek_at_[hidden]
C++ Booster (http://www.boost.org) office phone: (812) 855-3608
----------------------------------------------------------------------
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net