[C++-sig] vector_indexing_suite and std::string

greg Landrum greglandrum at mindspring.com
Tue Mar 16 17:25:12 CET 2004

The attached files create and test an extension module that uses the indexing_suite to return std::vectors containing ints and std::strings to Python.  The int vectors work just  fine, but the std::string vectors generate:
TypeError: No Python class registered for C++ class std::string
errors when the individual elements are accessed.

It's clearly not a problem with returning std::strings, because the bareString() function does that without any difficulties.

Ron Clarke posted about this a couple of weeks ago: 
but no solution or work-around was provided, so I figured I'd try again.

System details:
Boost: 1.31
Python: 2.2.3
OS: both Redhat8.0 (g++ v3.2)and Win2K (VC++ 7.1)

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: indexing_with_strings.cpp
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20040316/16714db6/attachment.txt>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: indexing_with_strings.py
Type: application/octet-stream
Size: 564 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20040316/16714db6/attachment.obj>

More information about the Cplusplus-sig mailing list