add string case
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7339 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
877535badf
commit
a923a51bd6
2 changed files with 13 additions and 0 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
%module li_std_vector
|
%module li_std_vector
|
||||||
|
|
||||||
|
%include "std_string.i"
|
||||||
%include "std_vector.i"
|
%include "std_vector.i"
|
||||||
%include "cpointer.i"
|
%include "cpointer.i"
|
||||||
%include "carrays.i"
|
%include "carrays.i"
|
||||||
|
|
@ -14,6 +15,7 @@ namespace std {
|
||||||
%template() vector<short>;
|
%template() vector<short>;
|
||||||
%template(IntVector) vector<int>;
|
%template(IntVector) vector<int>;
|
||||||
%template(BoolVector) vector<bool>;
|
%template(BoolVector) vector<bool>;
|
||||||
|
%template() vector<string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
%template(DoubleVector) std::vector<double>;
|
%template(DoubleVector) std::vector<double>;
|
||||||
|
|
@ -107,6 +109,12 @@ std::vector<short> halfs(const std::vector<short>& v) {
|
||||||
return w;
|
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(VecB) std::vector<Test::B>;
|
||||||
%template(VecA) std::vector<Test::A*>;
|
%template(VecA) std::vector<Test::A*>;
|
||||||
|
|
|
||||||
|
|
@ -89,3 +89,8 @@ if v.size() != 0:
|
||||||
raise RuntimeError,"bad getslice"
|
raise RuntimeError,"bad getslice"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
v = vecStr(["hello ", "world"])
|
||||||
|
if v[0] != 'hello world':
|
||||||
|
raise RuntimeError,"bad std::string+std::vector"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue