|
Boost Users : |
From: yi zhang (zhangyi.zhangyi_at_[hidden])
Date: 2008-02-15 19:23:54
Hi, everyone
'adj_list_ra_edgelist.cpp' is a simple example of bgl, but I can not compile
it with gcc 3.4.4 on cygwin/windows xp. Following are the codes:
#include <boost/config.hpp>
> #include <iostream>
> #include <boost/graph/adjacency_list.hpp>
>
> int
> main()
> {
> using namespace boost;
> typedef adjacency_list<vecS, vecS, bidirectionalS, no_property,
> property<int, edge_weight_t, property<int, edge_index_t> >,
> no_property, vecS> Graph;
>
> const std::size_t n = 3;
> typedef std::pair<std::size_t, std::size_t> E;
> E edge_array[] = { E(0,1), E(0,2), E(0,1) };
> const std::size_t m = sizeof(edge_array) / sizeof(E);
> Graph g(edge_array, edge_array + m, n);
> for (std::size_t i = 0; i < m; ++i)
> std::cout << edges(g).first[i] << " ";
> std::cout << std::endl;
>
> return 0;
> }
The error is located in the line 28, i.e. edges(g).first[i]. I think
edges(g).first has the type of adjacency_list::edge_iterator. But how can I
understand 'edges(g).first[i]'?
Thanks,
Timothy Zhang
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