From: SourceForge.net <no...@so...> - 2012-05-30 13:18:46
|
Bugs item #3519174, was opened at 2012-04-18 08:38 Message generated for change (Comment added) made by ionflux You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101645&aid=3519174&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: https://www.google.com/accounts () Assigned to: Nobody/Anonymous (nobody) Summary: map<int,Foo*> Initial Comment: Compilation failed when making use of %template of std::map, when the value of the std::map is a pointer to class instance. %template of std::vector works, and even make the %template of std::map work. For example: %module demo %{ #define SWIG_FILE_WITH_INIT class Foo { public: Foo(){}; }; %} %include "std_vector.i" %include "std_map.i" /* %template(vector_Foo) std::vector<Foo*>; */ %template(map_Foo) std::map<int,Foo*>; class Foo { public: Foo(); }; Using Swig 2.0.4, this example doesn't compile, unless the line '%template(vector_Foo)' is uncommented. Error is: demo_wrap.cpp: In function ‘const char* swig::type_name() [with Type = Foo]’: demo_wrap.cpp:3201: instantiated from ‘static swig_type_info* swig::traits_info<Type>::type_info() [with Type = Foo]’ demo_wrap.cpp:3208: instantiated from ‘swig_type_info* swig::type_info() [with Type = Foo]’ demo_wrap.cpp:3242: instantiated from ‘static PyObject* swig::traits_from_ptr<Type>::from(Type*, int) [with Type = Foo]’ demo_wrap.cpp:3254: instantiated from ‘static PyObject* swig::traits_from<Type*>::from(Type*) [with Type = Foo]’ demo_wrap.cpp:3267: instantiated from ‘PyObject* swig::from(const Type&) [with Type = Foo*]’ demo_wrap.cpp:4542: instantiated from here demo_wrap.cpp:3191: error: ‘type_name’ is not a member of ‘swig::traits<Foo>’ It seems that the problem was solved in swig-1.3.33: http://old.nabble.com/std::map-and-python-td15206781.html http://comments.gmane.org/gmane.comp.programming.swig/9472 ---------------------------------------------------------------------- Comment By: Joern P. Meier (ionflux) Date: 2012-05-30 06:18 Message: I can confirm this for swig-2.0.4. Couldn't test with 2.0.7 because of some other bug. The old workaround still works. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101645&aid=3519174&group_id=1645 |