[C++-sig] map_indexing_suite object map

Kelly Burkhart kelly.burkhart at gmail.com
Sun Feb 11 03:03:48 CET 2007


Is it possible to create a map of arbitrary python objects using the
map indexing suite?  I was hoping the following would work:

    class_<std::map<std::string, object> >("ObMap")
        .def(map_indexing_suite<std::map<std::string, object> >())
    ;

However it results in the following:

>>> from tst import *
>>> om = ObMap()
>>> om['1'] = 1
>>> v = om['1']
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: No Python class registered for C++ class boost::python::api::object
>>>

Is there any way to use map indexing suite in this way?

Thanks,

-K



More information about the Cplusplus-sig mailing list