pythonswigtypemaps

Returning arguments in SWIG/Python


According to Swig docs and the marvelous explanation at SWIG in typemap works, but argout does not by @Flexo, the argout typemap turns reference arguments into return values in Python.

I have a scenario, in which I pass a dict, which then is converted to an unordered_map in typemap(in), which then gets populated in the C++ lib. Stepping through the code, I can see the mapping changed after it returned from C++, so I wonder why there is not a possibility to just convert the unordered_map back in place in to the dict that was passed. Or is it possible by now and I'm just overlooking something?

Thanks!


Solution

  • I am a little confused as to what exactly you are asking, but my understanding is:

    So, under these assumptions, I'll try to help:

    I hope this helps. If you are still stuck at some point, please edit your question to make clear at which point you are having trouble.