我正在使用捆绑的属性,像这样
class cVertex { ... };
class eEdge { ... };
typedef boost::adjacency_list <
boost::vecS, boost::vecS, boost::undirectedS,
cVertex, cEdge >
graph_t;
graph_t myGraph;
这对顶点很有效。我可以编写代码来轻松访问顶点捆绑属性
const cVertex& v = myGraph[ *vertices(myGraph).first + idx ];
然而,同样的事情似乎不适用于边缘
const cEdge& e = myGraph[ *edges(myGraph).first + idx ];
我得到这些编译器错误
1>.\cGraph.cpp(109) : error C2678: binary '+' :
no operator found which takes a left-hand operand of type
'boost::detail::edge_desc_impl<Directed,Vertex>'
(or there is no acceptable conversion)
我也试过这个:
对于顶点,这很好用
boost::graph_traits<graph_t>::vertex_iterator vi = vertices(myGraph).first;
vi += idx;
但这会产生编译器错误
boost::graph_traits<graph_t>::edge_iterator ei = edges(myGraph).first;
ei += idx;
这是错误
>C:\boost\boost_1_51\boost/iterator/iterator_adaptor.hpp(330) :
error C3767: '+=': candidate function(s) not accessible
1> could be the friend function at 'C:\boost\boost_1_51\boost/graph/topology.hpp(63)' :
'+=' [may be found via argument-dependent lookup]