add string case

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7339 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2005-07-19 17:33:00 +00:00
commit 4a789f7409
2 changed files with 13 additions and 0 deletions

View file

@ -1,5 +1,6 @@
%module li_std_vector
%include "std_string.i"
%include "std_vector.i"
%include "cpointer.i"
%include "carrays.i"
@ -14,6 +15,7 @@ namespace std {
%template() vector<short>;
%template(IntVector) vector<int>;
%template(BoolVector) vector<bool>;
%template() vector<string>;
}
%template(DoubleVector) std::vector<double>;
@ -107,6 +109,12 @@ std::vector<short> halfs(const std::vector<short>& v) {
return w;
}
std::vector<std::string> vecStr(std::vector<std::string> v) {
v[0] += v[1];
return v;
}
%}
%template(VecB) std::vector<Test::B>;
%template(VecA) std::vector<Test::A*>;

View file

@ -89,3 +89,8 @@ if v.size() != 0:
raise RuntimeError,"bad getslice"
v = vecStr(["hello ", "world"])
if v[0] != 'hello world':
raise RuntimeError,"bad std::string+std::vector"