【发布时间】:2015-06-06 23:33:26
【问题描述】:
以下代码有错误:
AAA.cpp:23:15: required from here .../boost/include/boost/graph/subgraph.hpp:333:5: error: static assertion failed: (!is_same<edge_index_type, boost::detail::error_property_not_found>::value) AAA.cpp:27:21: error: no matching function for call to ‘add_vertex(foo(int, char**)::<anonymous enum>, Graph&)’ AAA.cpp:27:21: note: candidates are: .../boost/include/boost/graph/subgraph.hpp: In instantiation of ‘boost::subgraph<Graph>::subgraph(boost::subgraph<Graph>::vertices_size_type, const graph_property_type&) [with Graph = boost::adjacency_list<boost::setS, boost::setS, boost::directedS, boost::no_property, boost::no_property, boost::no_property, boost::setS>; boost::subgraph<Graph>::vertices_size_type = long unsigned int; boost::subgraph<Graph>::graph_property_type = boost::no_property]’:
#include <boost/config.hpp>
#include <iostream>
#include <boost/graph/subgraph.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/graph_utility.hpp>
int foo(int,char*[])
{
using namespace boost;
typedef subgraph<
adjacency_list<
setS,
setS,
directedS,
no_property,
no_property,
no_property, // graph prop
setS // edgelist
>
> Graph;
const int N = 6;
Graph G0(N);
enum { A, B, C, D, E, F};
Graph& G1 = G0.create_subgraph();
add_vertex(C, G1); // global vertex C becomes local A1 for G1
return 0;
}
如果我将顶点列表的 setS 更改为 vecS,则可以编译它。 如何使用 setS 顶点列表创建 boost 子图?
谢谢,
【问题讨论】: