[Boost.Python] Wrapping a heterogeneous container
Hi. I have finally figured out how to (mostly) wrap a container of boost::variant<> in boost::python: http://blind.guru/boost_python-and-boost_variant.html The only problem left is the fact that I have to disable the use of reference semantics (proxies) in vector_indexing_suite. If I pass false for the NoProxy template parameter of vector_indexing_suite<>, I can no longer dereference container elements:
import bpv bpv.make_vector()[0] Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: No Python class registered for C++ class boost::variant
However, I have a converter registered with to_python_converter<> that handles extracting the proper Python object from a variant. This works if NoProxy is true. However, if NoProxy is true, container elements do not have reference semantics, so in-place modifications will be lost. To me, it also looks like the TypeError raise above is sort of bogus, since I actually used to_python_converter to register conversion for this particular type. So I guess there are different types of registries involved, but the message does not indicate which registry is did refer to. Does anyone know if I can enable reference semantics for a heterogeneous container wrapped with indexing_suite? -- CYa, ⡍⠁⠗⠊⠕
participants (1)
-
Mario Lang