【发布时间】:2011-12-23 11:47:58
【问题描述】:
我正在尝试使用 boost 的 topological_sort 功能。
我使用带有 setS 和 listS 的 boost::adjacency_list 作为边和顶点的底层存储。
typedef boost::adjacency_list<boost::setS, boost::listS, boost::bidirectionalS > SizerGraph;
SizerGraph sizerGraph;
typedef boost::graph_traits<SizerGraph>::vertex_descriptor Vertex;
boost::topological_sort(sizerGraph, std::ostream_iterator<Vertex>(std::cout, "\n"));
编译会导致错误。 (g++ 3.4.6)
/usr/include/boost/property_map.hpp:349:错误:不匹配 '运算符+' in '((const boost::iterator_property_map<:__normal_iterator>>, boost::adj_list_vertex_property_map, boost::detail::error_property_not_found, 常量 boost::detail::error_property_not_found&, boost::vertex_index_t>, boost::default_color_type, boost::default_color_type&>*)this)->boost::iterator_property_map<:__normal_iterator>>, boost::adj_list_vertex_property_map, boost::detail::error_property_not_found, 常量 boost::detail::error_property_not_found&, boost::vertex_index_t>, boost::default_color_type, boost::default_color_type&>::iter + boost::get [与 PropertyMap = boost::adj_list_vertex_property_map, boost::detail::error_property_not_found, 常量 boost::detail::error_property_not_found&, boost::vertex_index_t>, 参考 = const boost::detail::error_property_not_found&, K = void*](((const boost::put_get_helper, boost::detail::error_property_not_found, 常量 boost::detail::error_property_not_found&, boost::vertex_index_t>
&)((const boost::put_get_helper, boost::detail::error_property_not_found, 常量 boost::detail::error_property_not_found&,boost::vertex_index_t> *)(((const boost::adj_list_vertex_property_map, boost::detail::error_property_not_found, 常量 boost::detail::error_property_not_found&, boost::vertex_index_t>*)((const boost::iterator_property_map<:__normal_iterator>>, boost::adj_list_vertex_property_map, boost::detail::error_property_not_found, 常量 boost::detail::error_property_not_found&, boost::vertex_index_t>, boost::default_color_type, boost::default_color_type&>)this)) + 8u))), ((void const&)((void* const*)(&v))))'
/usr/include/boost/graph/detail/adjacency_list.hpp:2264:错误:否 调用 `get_property_value(boost::no_property&, boost::vertex_index_t)
但是,使用 vecS 作为顶点的底层存储机制会导致干净的编译。
我将 listS 用于顶点是否违反了任何概念要求?
【问题讨论】:
-
您好,在我发现 this 的 boost 讨论组上进行谷歌搜索。需要尝试一下。
标签: boost generic-programming topological-sort