From aef1bfcf1aed46e32f9a1137a812f3e9bb162a0c Mon Sep 17 00:00:00 2001 From: Marcelo Matus Date: Thu, 4 May 2006 05:24:41 +0000 Subject: [PATCH] fix std::vector, reported by tagna@gaia.ecs.csus.edu git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9084 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- SWIG/Examples/test-suite/python/li_std_vector.i | 4 ++++ SWIG/Lib/python/pystdcommon.swg | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/SWIG/Examples/test-suite/python/li_std_vector.i b/SWIG/Examples/test-suite/python/li_std_vector.i index d9a50526e..278c37623 100644 --- a/SWIG/Examples/test-suite/python/li_std_vector.i +++ b/SWIG/Examples/test-suite/python/li_std_vector.i @@ -122,3 +122,7 @@ std::vector vecStr(std::vector v) { %template(pyvector) std::vector; + +namespace std { + %template(ConstIntVector) vector; +} diff --git a/SWIG/Lib/python/pystdcommon.swg b/SWIG/Lib/python/pystdcommon.swg index fa8d047fd..c9e869f3f 100644 --- a/SWIG/Lib/python/pystdcommon.swg +++ b/SWIG/Lib/python/pystdcommon.swg @@ -22,6 +22,13 @@ namespace swig { } }; + template struct traits_from { + static PyObject *from(const Type* val) { + return traits_from_ptr::from(const_cast(val), 0); + } + }; + + template inline PyObject *from(const Type& val) { return traits_from::from(val);