another case

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5869 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2004-04-11 06:51:49 +00:00
commit 5993e83ee4
2 changed files with 12 additions and 1 deletions

View file

@ -11,6 +11,7 @@
%}
namespace std {
%template() vector<short>;
%template(IntVector) vector<int>;
%template(BoolVector) vector<bool>;
}
@ -73,6 +74,14 @@ struct B : public A {
int f(const int i) const { return i + val; }
};
}
std::vector<short> halfs(const std::vector<short>& v) {
std::vector<short> w(v);
for (std::vector<short>::size_type i=0; i<w.size(); i++)
w[i] /= 2;
return w;
}
%}
%template(VecB) std::vector<Test::B>;
%template(VecA) std::vector<Test::A*>;

View file

@ -38,9 +38,11 @@ if va[3].f(1) != 8:
ip = PtrInt()
ap = new_ArrInt(10)
vi = IntPtrVector((ip,ap,None,(2,3)))
vi = IntPtrVector((ip,ap,None))
if vi[1] != ap:
raise RuntimeError,"bad std::vector<int*> mapping"
a = halfs([10,8,4,3])