From: SourceForge.net <no...@so...> - 2011-02-18 23:33:58
|
Bugs item #1498929, was opened at 2006-06-01 15:21 Message generated for change (Comment added) made by wsfulton You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101645&aid=1498929&group_id=1645 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: python Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: B Martin (bjmartin) Assigned to: Marcelo Matus (marcelomatus) Summary: c++ std::map fails with class in python Initial Comment: 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. Here are the contents of test_std_map.i: ========================================== %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 ---------------------------------------------------------------------- >Comment By: William Fulton (wsfulton) Date: 2011-02-18 23:33 Message: Just a note that the behaviour is still the same in svn (just before swig-2.0.2 release) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101645&aid=1498929&group_id=1645 |