So I have an std::map<KeyType, std::shared_ptr<ValueType>> exposed up to python using map_indexing_suite.
In other places in the code I store references to the ValueType objects in the map using raw pointers, ValueType*, because those containers don’t own the ValueType objects, the map does.
My question is, how can I expose the raw pointer to python in a way it can compare that reference to the shared pointer? Something like this:
valueRef = getRawReference()
for x in myMap:
if x.data() == valueRef:
print "match"
Found the answer myself.
First define two methods:
Then in your BOOST_PYTHON_MODULE: