mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-23 05:35:13 +00:00
1b05ce5bc0
The pointer to the first member of a class instance is the same as the pointer to instance itself; pybind11 has some workarounds for this to not track registered instances that have a registered parent with the same address. This doesn't work everywhere, however: issue #328 is a failure of this for a mutator operator which resolves its argument to the parent rather than the child, as is needed in #328. This commit resolves the issue (and restores tracking of same-address instances) by changing registered_instances from an unordered_map to an unordered_multimap that allows duplicate instances for the same pointer to be recorded, then resolves these differences by checking the type of each matched instance when looking up an instance. (A unordered_multimap seems cleaner for this than a unordered_map<list> or similar because, the vast majority of the time, the instance will be unique). |
||
---|---|---|
.. | ||
pybind11 |