Boost logo

Boost Users :

From: Doug Gregor (dgregor_at_[hidden])
Date: 2007-08-30 11:47:53


On Aug 30, 2007, at 12:47 AM, Sara Ting wrote:
> I need to use the overload of add_vertex that takes the vertex
> property
> object as a parameter. I am using a mix of internal and bundled
> properties
> because I had to add the vertex_index property but did not want to
> clutter
> my bundled property with an index field. How do I instantiate this
> mixed
> property object to call add_vertex(vp, graph)?
>
> For reference, my graph is defined like this:
> adjacency_list<vecS, listS, indirectedS,
> boost::property<boost::vertex_index_t, int, MyNodeProperties>,
> MyEdgeProperties>
>
> I basically want to do this call:
> add_vertex(myNodeProp, graph)
> but I am getting a compilation error that it is not a
> boost::property<....>
> type. How do I wrap my bundled property in an object that I can
> pass to
> this function?
>

I believe this will do it:

        add_vertex(boost::property<boost::vertex_index_t, int,
MyNodeProperties>(num_vertices(graph), myNodeProp), graph);

        - Doug


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