いくつかのテストの後、stamp_times ビジターが問題であることがわかりました。
typedef adjacency_list <vecS, vecS, undirectedS> Graph;
typedef graph_traits <Graph>::edge_descriptor Edge;
typedef graph_traits <Graph>::vertex_descriptor Vertex;
Graph g(edges.begin(), edges.end(), n);
typedef graph_traits <Graph>::vertices_size_type Size;
std::vector<Size> dtime(num_vertices(g));
Size time = 0;
breadth_first_search(g, s, visitor(make_bfs_visitor(
stamp_times(dtime.begin(), time, on_discover_vertex()))));
(そのコードで同じエラーが少なくなりました)。
1 つは前任者を記録するため、もう 1 つは訪問時間を取得するために 2 人の訪問者を使用する必要があります。
boost::breadth_first_search
(g, s,
boost::visitor(boost::make_bfs_visitor
(std::make_pair(
boost::record_predecessors(&p[0], boost::on_tree_edge()),
stamp_times(dtime.begin(), time, on_discover_vertex())))));
しかし、このコード イベントはコンパイルされません。次のエラーが発生します。
/usr/include/boost/graph/visitors.hpp: In member function ‘void boost::time_stamper<TimeMap, TimeT, Tag>::operator()(Vertex, const Graph&) [with Vertex = long unsigned int, Graph = boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS>, TimeMap = __gnu_cxx::__normal_iterator<long unsigned int*, std::vector<long unsigned int> >, TimeT = long unsigned int, Tag = boost::on_discover_vertex]’:
/usr/include/boost/graph/visitors.hpp:109:8: instantiated from ‘void boost::detail::invoke_dispatch(Visitor&, T, Graph&, mpl_::true_) [with Visitor = boost::time_stamper<__gnu_cxx::__normal_iterator<long unsigned int*, std::vector<long unsigned int> >, long unsigned int, boost::on_discover_vertex>, T = long unsigned int, Graph = const boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS>, mpl_::true_ = mpl_::bool_<true>]’
/usr/include/boost/graph/visitors.hpp:140:5: instantiated from ‘void boost::invoke_visitors(Visitor&, T, Graph&, Tag) [with Visitor = boost::time_stamper<__gnu_cxx::__normal_iterator<long unsigned int*, std::vector<long unsigned int> >, long unsigned int, boost::on_discover_vertex>, T = long unsigned int, Graph = const boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS>, Tag = boost::on_discover_vertex]’