我有一個圖表,捆綁性提升:應用dijkstra_shortest_path()來filtered_graph
//property
struct Edge
{
int distance;
};
//graph
typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS, Node, Edge> graph_t;
//predicate
template <typename Graph>
struct Filter
{
const Graph gr;
Filter(const Graph &g): gr(g) {}
bool operator() (const Edge &e) const {
if(gr[e].distance < 5) return 0;
return 1;
}
};
Filter <graph_t> filter(g);
boost::filtered_graph <graph_t, Filter <graph_t> > fg(g, filter);
而且我想申請dijkstra_shortest_path算法過濾圖。
std::vector<int> d(num_vertices(fg));
std::vector<v> p(boost::num_vertices(fg));
boost::dijkstra_shortest_paths(fg, nodes[0], boost::weight_map(get(&Edge::distance, fg))
.distance_map(boost::make_iterator_property_map(d.begin(), get(boost::vertex_index, fg)))
.predecessor_map(boost::make_iterator_property_map(p.begin(), get(boost::vertex_index, fg))));
我得到的,在編譯時的錯誤是:
/Users/artem/Documents/boost_1_55_0/boost/concept_check.hpp:142:錯誤:類型的boost :: filter_iterator>,升壓的對象:: keep_all,boost :: filtered_graph,Filter>,boost :: keep_all >>,boost :: detail :: out_edge_iter,void *>,Edge> *>,unsigned long,boost :: detail :: edge_desc_impl,long >> '不能被分配,因爲它的拷貝分配操作符被隱式刪除 a = b; //要求賦值運算符 ^
什麼是不正確的?不能真正瞭解,如何解決這個問題。