Skip to content
Advertisement

How to marshal through py::dict in C++ passing from pybind11

I try to pass a dictionary (unordered_map) structure from python to C++ through pybind11. On the python side I am trying to do:

JavaScript

On the C++ side, I have

JavaScript

It prints garbage data. I used reinterpret_cast to satisfy the Visual Studio compiler.

Advertisement

Answer

I sort of solve this by using py::cast on the C++ side:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement