diff --git a/Examples/test-suite/python/li_std_vector.i b/Examples/test-suite/python/li_std_vector.i index d9a50526e..278c37623 100644 --- a/Examples/test-suite/python/li_std_vector.i +++ b/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/Lib/python/pystdcommon.swg b/Lib/python/pystdcommon.swg index fa8d047fd..c9e869f3f 100644 --- a/Lib/python/pystdcommon.swg +++ b/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);