Related to bug 1480074
In SWIG 1.3.21 it was possible to create a map from the
std::map class that mapped to a c++ class, and
subsequently modify the contents of the class from
Python. Using the latest CVS source (or any release
version since 1.3.21), it is possible to create and
manipulate the map and it's contents (the classes), but
not the member variables of the class.
%module SWIGTest
%inline %{
int i;
class TestA {
public:
TestA() { i = 1; }
int i;
};
%}
%include std_pair.i
%include std_map.i
namespace std
{
%template(pairii) pair<int,int>;
%template(mapii) map<int,int>;
%template(pairita) pair<int,TestA>;
%template(mapita) map<int,TestA>;
}
==========================================
And a sample script:
>>> from SWIGTest import *
>>> a = mapita()
>>> a[1] = TestA()
>>> a[1].i
1
>>> a[1].i = 2
>>> a[1].i
1
Just a note that the behaviour is still the same in svn (just before swig-2.0.2 release)
Fixed in revision 12643.