[C++-sig] dumb policy question
John Arbash Meinel
john at arbash-meinel.com
Tue Jan 31 17:22:37 CET 2006
Grant Goodyear wrote:
> Okay, so I read through the FAQ again and see "How can I wrap
> functions which take C++ containers as arguments", from which I
> gather that the answer is "it's really darn hard, and probably
> not worth the effort", if I understand it correctly.
I usually export std::vector<int> into python. With something like this:
scope outer = class_<Vec, boost::noncopyable>("Vec", no_init);
class_< std::vector<signed char> >("i8")
.def(vector_indexing_suite< std::vector<signed char> >())
class_< std::vector<unsigned char> >("ui8")
.def(vector_indexing_suite< std::vector<unsigned char> >())
Then the vectors I care about are available as:
v = libpyref.Vec.i32()
I don't know if that helps you or not, but it is how I solved the problem.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 252 bytes
Desc: OpenPGP digital signature
More information about the Cplusplus-sig