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@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&lt;boost::shared_ptr&lt;GameObject&gt;>`?

--
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@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig