mirror of https://github.com/swig/swig
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:
parent
512cf3d12d
commit
fd666c1440
|
@ -516,6 +516,7 @@ C_TEST_CASES += \
|
|||
MULTI_CPP_TEST_CASES += \
|
||||
clientdata_prop \
|
||||
imports \
|
||||
import_stl \
|
||||
packageoption \
|
||||
mod \
|
||||
template_typedef_import \
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
import_stl_a
|
||||
import_stl_b
|
|
@ -0,0 +1,5 @@
|
|||
%module import_stl_a
|
||||
|
||||
%include <std_vector.i>
|
||||
%template(VectorInt) std::vector<int>;
|
||||
|
|
@ -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;
|
||||
}
|
||||
%}
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue