[C++-sig] using shared_ptrs with the vector_indexing_suite

Greg Landrum greg.landrum at gmail.com
Fri Jan 7 23:56:55 CET 2005


I'm attempting to get shared_ptrs working in combination with the
vector_indexing_suite in order to make it easy to return std::vectors
of shared_ptrs from our code.

I feel like I've got a reasonable grasp of what's required to return
shared_ptrs (given how easy that is now, this isn't much of an
accomplishment), and I've even managed to get them working with the
iterator interface, but the combination with vector_indexing_suite
eludes me.

The attached module and testing code demonstrate the problem.  When I
build this module and run the test (linux, python 2.3.4, g++ 3.2,
boost 1.32), all the tests pass except for test5 and test5b, which use
std::vectors of shared_ptrs. Both of those tests fail with the error:

TypeError: No Python class registered for C++ class boost::shared_ptr<DemoKlass>

Because the basic shared_ptr operations and the more complicated
iterator stuff work, I'm guessing this has something to do with the
vector_indexing_suite itself.

Thanks in advance for any help,
-greg
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: module.cpp
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20050107/4ffbdf8a/attachment.txt>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.py
Type: text/x-python
Size: 1321 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20050107/4ffbdf8a/attachment.py>


More information about the Cplusplus-sig mailing list