c++ - Create and access frozenset with Boost Python -
i have c++ methods have std::set<std::string>
argument or return value. map python frozenset
(or regular set
) there not seem straightforward way this. know how 1 may accomplish task.
unfortunately, standard indexing_suite
boost.python not support std::set
. there indexing_suite v2, works on stl containers. (http://mail.python.org/pipermail/cplusplus-sig/2009-july/014704.html)
it may not have made official distribution, can find asking around. (http://mail.python.org/pipermail/cplusplus-sig/2009-july/014691.html)
i found harder use original indexing_suite
, might fit needs.
if not work, can manually wrap std::set<std::string>
other class. std::set<std::string>
python, can turn python set
easily.
i think both of more work called though. here do:
first, wrap function in c++ 1 has same signature, stuffs returned data in std::vector<std::string>
instead of std::set<std::string>
. expose function rather original
now have data in python.
second, wrap c++ function in python function takes data in std::vector<std::string>
, stuffs python set
.
yes, rather silly design aesthetics point of view, , not performant code in world, gets going minimum of code, , robust.
Comments
Post a Comment