How to obtain vertex pointer (not descriptor) of vertex created with add_vertex.
Hi, I am trying to modify a set of file parser callback functions (for a custom file format) to populate a Boost graph. The callbacks provide a (void*) pointer style parameter passing. But Boost graph method add_vertex(graph) will return a vertex descriptor. How do I obtain the pointer information for this newly added vertex so that the pointer can be cast as (void*) and passed to the appropriate call back? Thanks, Ananth
Ananth Durbha wrote:
I am trying to modify a set of file parser callback functions (for a custom file format) to populate a Boost graph. The callbacks provide a (void*) pointer style parameter passing. But Boost graph method add_vertex(graph) will return a vertex descriptor. How do I obtain the pointer information for this newly added vertex so that the pointer can be cast as (void*) and passed to the appropriate call back?
If you're writing the code that calls the callback, what about something
like this (untested):
struct CallbackData
{
/* vertex descriptor type */ vertex_desc;
};
...
CallbackData cdata;
cdata.vertex_desc = add_vertex(...);
(*callback)(reinterpret_cast
participants (2)
-
Ananth Durbha
-
Nat Goodspeed