2011-01-26 7 views
2

私は構造体を作成し、adjacency_listのテンプレートパラメータとして使用しました。しかし、add_edge(vertex1、vertex2、property、graph)を試そうとすると、コンパイラは「一致する関数呼び出しがありません」と不平を言う。私はどこに間違っているのか誰にでも見える?BGLバンドルプロパティadd_edge "no matching function"

#include <iostream> 
#include <boost/graph/adjacency_list.hpp> 

// Create a struct to hold several properties 
struct MyProperty 
{ 
    int MyIntProperty; 
}; 

// Define the type of the graph 
typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, MyProperty> Graph; 

int main(int,char*[]) 
{ 
    // Create a graph object 
    Graph g(2); 

    // Add an edge between node 0 and node 1 with weight 1.2 
    MyProperty p; 
    p.MyIntProperty = 5; 
    std::cout << p.MyIntProperty << std::endl; 
    add_edge(0, 1, p, g); 

    return 0; 
} 

このコードのおかげで、

デビッド

答えて

4

は、MyProperty頂点プロパティではなくエッジプロパティとして宣言され、それは、その性質とエッジを挿入する意味がありません。 adjacency_list typedefにをMyPropertyの前に追加してみてください。

関連する問題