Python builtin C++11 STL fixes

Compilation fixes for std::multimap, std::unordered_map and
std::unordered_multimap.
This commit is contained in:
William S Fulton 2017-06-19 20:32:32 +01:00
commit b56d7c0539
3 changed files with 30 additions and 0 deletions

View file

@ -75,7 +75,17 @@
%define %swig_unordered_multimap_methods(Type...)
%swig_unordered_map_common(Type);
#if defined(SWIGPYTHON_BUILTIN)
%feature("python:slot", "mp_ass_subscript", functype="objobjargproc") __setitem__;
#endif
%extend {
// This will be called through the mp_ass_subscript slot to delete an entry.
void __setitem__(const key_type& key) {
self->erase(key);
}
void __setitem__(const key_type& key, const mapped_type& x) throw (std::out_of_range) {
self->insert(Type::value_type(key,x));
}