[C++-sig] C++ object pointers contained in a vector

Roman Yakovenko roman.yakovenko at gmail.com
Wed Oct 18 22:09:41 CEST 2006


On 10/18/06, Noah Schwartz <noah.schwartz1 at gmail.com> wrote:
> Hi,
>
> I've used the vector_indexing_suite to expose vectors containing pointers to
> some class. I see that I can't iterate over this vector in Python like I can
> with say, a vector of floats. I get the following error:
> TypeError: No to_python (by-value) converter found for C++ type: MyClass*
>
> MyClass is already exposed properly. I can even use a MyClass* fine in Python
> when other C++ functions return a pointer to one.
>
> I am guessing that I need to define a to_python converter either in MyClass or
> in a new class, MyClass*. Not really sure how that works though.

Try to set NoProxy to true

http://boost.org/libs/python/doc/v2/indexing.html#indexing_suite

Does it help?

-- 
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/



More information about the Cplusplus-sig mailing list