new %import test for vector

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12633 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2011-04-11 21:28:06 +00:00
parent 512cf3d12d
commit fd666c1440
6 changed files with 32 additions and 2 deletions

View File

@ -516,6 +516,7 @@ C_TEST_CASES += \
MULTI_CPP_TEST_CASES += \
clientdata_prop \
imports \
import_stl \
packageoption \
mod \
template_typedef_import \

View File

@ -0,0 +1,2 @@
import_stl_a
import_stl_b

View File

@ -0,0 +1,5 @@
%module import_stl_a
%include <std_vector.i>
%template(VectorInt) std::vector<int>;

View File

@ -0,0 +1,13 @@
%module import_stl_b
%import "import_stl_a.i"
%inline %{
#include <vector>
std::vector<int> process_vector(const std::vector<int>& v) {
std::vector<int> v_new = v;
v_new.push_back(4);
return v_new;
}
%}

View File

@ -0,0 +1,7 @@
import import_stl_b
import import_stl_a
v_new = import_stl_b.process_vector([1,2,3])
if v_new != (1,2,3,4):
raise RuntimeError, v_new

View File

@ -129,12 +129,13 @@ namespace swig {
}
};
%#if defined(SWIGPYTHON_BUILTIN)
inline PyObject* make_output_iterator_builtin (PyObject *pyself)
{
Py_INCREF(pyself);
return pyself;
}
%#endif
}
}
@ -310,6 +311,7 @@ namespace swig {
return new SwigPyIteratorOpen_T<OutIter>(current, seq);
}
%#if defined(SWIGPYTHON_BUILTIN)
template <typename Sequence>
inline PyObject* make_output_iterator_builtin_T (PyObject *pyself)
{
@ -320,7 +322,7 @@ namespace swig {
SwigPyIterator *iter = make_output_iterator(seq->begin(), seq->begin(), seq->end(), pyself);
return SWIG_InternalNewPointerObj(iter, SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN);
}
%#endif
}
}