|
Boost Users : |
From: Aaron Windsor (aaron.windsor_at_[hidden])
Date: 2007-12-19 21:58:16
On Dec 19, 2007 2:05 AM, tonyaim83 <abhishek.v_at_[hidden]> wrote:
>
> Hi..
>
> My Sample Previous code look like
>
> #include "src-graphml.hpp"
> using namespace std;
> using namespace boost;
>
> int main(int argc, char** argv)
> {
> typedef adjacency_list<vecS,vecS,directedS,
> property<vertex_name_t,string>,
> property<edge_weight_t,double> > graph_t;
> graph_t g;
> dynamic_properties dp;
> dp.property("color",get(vertex_name_t(),g));
> dp.property("weight",get(edge_weight_t(),g));
> return 0;
> }
>
> Now i have added one more property to the vertex and i m using bundled
> property for declaration.So now
> my code look like..
>
> #include "src-graphml.hpp"
>
> using namespace std;
> using namespace boost;
>
> struct node
> {
> string name;
> string path;
> };
>
>
> int main(int argc, char** argv)
> {
> typedef adjacency_list<vecS,vecS,directedS,
> node,property<edge_weight_t,double> > graph_t;
> graph_t g;
> dynamic_properties dp;
>
> dp.property("name",g().name);
> dp.property("file",g[*node].path);
>
> dp.property("weight",get(edge_weight, g));
> return 0;
> }
>
> I have quoted with bold tag the one in which i m getting compilation error
> just let me know how to use it correctly..
> Thanks in advance..
I don't know which line you intended to put in bold, but doesn't the
following look strange to you?
> dp.property("name",g().name);
> dp.property("file",g[*node].path);
Why not try "get(&node::name, g)" to get the node::name property
instead of "g().name", and "get(&node::path,g)" instead of
"g[*node].path" to get the node::path property?
Regards,
Aaron
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net