[C++-sig] Wrapping Boost graph vertex/edge descriptors (void pointers) with Boost.Python

Rocco Moretti rmorettiase at gmail.com
Mon Nov 25 19:07:53 CET 2013


Hello all,

We have a C++ library that uses the Boost graph library, and has functions
which return and take the boost graph vertex and edge descriptors. The
issue I'm running into with using Boost.Python is that for the
implementation of the graph that we've chose (the listS/listS one), the
edge and vertex descriptors are internally implemented as void pointers.

Not using void pointers isn't an option (the use of void pointers is a
choice by Boost graph for the style of graph we're using, which has other
considerations feeding into it). I don't really need to interact with the
vertex and edge descriptors at all at the Python level, aside from passing
them around and then back to other C++ level functions (and perhaps doing
equality comparisons, but that's not strictly necessary). I certainly don't
need to dereference them or type convert them. Even at the C++ level we
never deal with them as actual void pointers, instead having them be
typedefed, and using that consistent typedefed type as an opaque type.

What would be the best way to have Boost.Python deal with these edge and
vertex descriptors? I looked at opaque pointer policy stuff, but from what
I can tell so far, that doesn't really work with void pointers.

Thank You,
-Rocco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20131125/d4738d7d/attachment.html>


More information about the Cplusplus-sig mailing list