Unfortunately, the standard indexing_suite from Boost.Python does not support std::set . There is indexing_suite v2 that works in all stl containers. (Http://mail.python.org/pipermail/cplusplus-sig/2009-July/014704.html)
It may not have gotten into the official distribution, but you can find it by asking around. (Http://mail.python.org/pipermail/cplusplus-sig/2009-July/014691.html)
It was harder for me to use the original indexing_suite , but it could fit your needs.
If this does not work, you can simply wrap std::set<std::string> manually, just like any other class. This will give you std::set<std::string> in python, where you can easily turn it into a python set .
I think both of them are more work, but this is required. Here is what I will do:
First, wrap a C ++ function with one that has the same signature, but load the returned data into std::vector<std::string> instead of std::set<std::string> . set this function, not the original
You now have data in python.
Secondly, wrap the C ++ function in a python function that takes the data in std::vector<std::string> and inserts it into the python set .
Yes, this is pretty stupid in terms of design aesthetics, not the most advanced code in the world, but you get to where you go with minimal code, and it's pretty reliable.
source share