[C++-sig] Wrap std::vector<pointer*>
Simon W
simwarg at gmail.com
Tue Aug 2 00:10:53 CEST 2011
I wrap my c++ vector like:
class_<GameObject*>("GameObjectList")
.def(vector_index_suite<GameObject*>);
When I run the following in python:
objects = gameobject_manager.getGameObjects() # getGameObjects is returning
a std::vector<GameObject*>
for object in objects:
...
I get the error
> TypeError: No to_python (by-value) converter found for C++ type:
> GameObject*
I have not tried shared_ptr because I waas hoping on another solution since
it would require a lot of changes to make it a shared_ptr.
On Mon, Aug 1, 2011 at 4:58 PM, diego_pmc <paulc.mnt at gmail.com> wrote:
> You don't really provide that much information: you want help with writing
> a
> wrapper? do you want C++ and Python to point to the same instance of
> `GameObject`? If it's the latter, have you tried doing
> `vector<boost::shared_ptr<GameObject>>`?
>
> --
> View this message in context:
> http://boost.2283326.n4.nabble.com/Wrap-std-vector-pointer-tp3708421p3709907.html
> Sent from the Python - c++-sig mailing list archive at Nabble.com.
> _______________________________________________
> Cplusplus-sig mailing list
> Cplusplus-sig at python.org
> http://mail.python.org/mailman/listinfo/cplusplus-sig
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20110802/8b38e264/attachment.html>
More information about the Cplusplus-sig
mailing list