From e167400a2909c68eb08e86896f8834f39ee9f09b Mon Sep 17 00:00:00 2001 From: Stefan Zager Date: Fri, 15 Jul 2011 18:49:32 +0000 Subject: [PATCH] Fixed issue from swig-user 6/27/11. Support code in std_map.i needs all the template parameters that std::map takes, even the default ones (Compare, Allocator). git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12759 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- CHANGES.current | 3 +++ Lib/python/std_map.i | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/CHANGES.current b/CHANGES.current index 3b1ccfcb7..dda3e410d 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -5,6 +5,9 @@ See the RELEASENOTES file for a summary of changes in each release. Version 2.0.5 (in progress) =========================== +2011-07-13: szager + [python] Add all template parameters to map support code in std_map.i + 2011-07-13: szager Fix for bug 3324753: %rename member variables with -builtin. diff --git a/Lib/python/std_map.i b/Lib/python/std_map.i index fec816222..37d749790 100644 --- a/Lib/python/std_map.i +++ b/Lib/python/std_map.i @@ -5,19 +5,19 @@ %fragment("StdMapTraits","header",fragment="StdSequenceTraits") { namespace swig { - template + template inline void - assign(const SwigPySeq& swigpyseq, std::map *map) { - typedef typename std::map::value_type value_type; + assign(const SwigPySeq& swigpyseq, std::map *map) { + typedef typename std::map::value_type value_type; typename SwigPySeq::const_iterator it = swigpyseq.begin(); for (;it != swigpyseq.end(); ++it) { map->insert(value_type(it->first, it->second)); } } - template - struct traits_asptr > { - typedef std::map map_type; + template + struct traits_asptr > { + typedef std::map map_type; static int asptr(PyObject *obj, map_type **val) { int res = SWIG_ERROR; SWIG_PYTHON_THREAD_BEGIN_BLOCK; @@ -27,7 +27,7 @@ /* In Python 3.x the ".items()" method returns a dict_items object */ items = PySequence_Fast(items, ".items() didn't return a sequence!"); %#endif - res = traits_asptr_stdseq, std::pair >::asptr(items, val); + res = traits_asptr_stdseq >::asptr(items, val); } else { map_type *p; res = SWIG_ConvertPtr(obj,(void**)&p,swig::type_info(),0); @@ -38,9 +38,9 @@ } }; - template - struct traits_from > { - typedef std::map map_type; + template + struct traits_from > { + typedef std::map map_type; typedef typename map_type::const_iterator const_iterator; typedef typename map_type::size_type size_type;