associative_property_mapを使用して頂点のインデックスを含めようとしていますが、次の簡単なコードで次のエラーが発生します。問題は何ですか?
#include <boost/graph/iteration_macros.hpp>
#include <boost/graph/adjacency_list.hpp>
using namespace std;
using namespace boost;
struct NodeData
{
int label;
};
struct EdgeData
{
int age;
};
typedef map<vecS, size_t> IndexMap;
IndexMap mapIndex;
associative_property_map<IndexMap> propmapIndex(mapIndex);
typedef adjacency_list<setS, setS, undirectedS, NodeData, EdgeData> Graph;
typedef Graph::vertex_descriptor NodeID;
typedef Graph::edge_descriptor EdgeID;
int main()
{
Graph g;
NodeID n0 = add_vertex(g); g[n0].label = -1;
NodeID n1 = add_vertex(g); g[n1].label = -1;
EdgeID edge; bool ok;
tie(edge, ok) = boost::add_edge(n0, n1, g);
if (ok) g[edge].age = 10;
int i=0;
BGL_FORALL_VERTICES(v, g, Graph)
{
put(propmapIndex, v, i++);
}
return 0;
}
エラー:
c:\program files\codeblocks\mingw\bin..\lib\gcc\mingw32\4.4.1........\include\boost\property_map\property_map.hpp||In
function'void boost :: put(const boost :: put_get_helper&、K、const V&)[with PropertyMap = boost ::associative_property_map、std :: allocator>
、Reference = unsigned int&、K = void *、V = int]':| C:\ Users \ memo \ Desktop \ Debuged \ boostGraph \ main.cpp |39|ここからインスタンス化| c:\ program files \ codeblocks \ mingw \ bin .. \ lib \ gcc \ mingw32 \ 4.4.1 ........ \ include \ boost \ property_map \ property_map.hpp | 361 |エラー:'に一致しませんoperator []'in'(const boost ::associative_property_map、std :: allocator >>>&)((const boost ::associative_property_map、std :: allocator >>> *)(&pa))[k]'| c:\ program files \ codeblocks \ mingw \ bin .. \ lib \ gcc \ mingw32 \ 4.4.1 ........ \ include \ boost \ property_map \ property_map.hpp | 498 |注:候補は次のとおりです:typename UniquePairAssociativeContainer :: value_type :: second_type&boost ::associative_property_map :: operator [](const typename UniquePairAssociativeContainer :: key_type&)const [with UniquePairAssociativeContainer = std :: map、std :: allocator >>] | || ===ビルドが完了しました:1エラー、0警告=== |
ありがとう