add template + opaque type test

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5934 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2004-05-27 11:44:33 +00:00
commit da6e5673e8
2 changed files with 36 additions and 0 deletions

View file

@ -0,0 +1,7 @@
import template_opaque
v = template_opaque.OpaqueVectorType(10)
template_opaque.FillVector(v)
print v[0]

View file

@ -0,0 +1,29 @@
%module template_opaque
%include std_vector.i
%{
namespace A
{
struct OpaqueStruct
{
};
}
%}
%inline {
namespace A {
struct OpaqueStruct;
typedef struct OpaqueStruct OpaqueType;
typedef std::vector<OpaqueType> OpaqueVectorType;
void FillVector(OpaqueVectorType& v)
{
for (int i = 0; i < v.size(); ++i) {
v[i] = OpaqueStruct();
}
}
}
}
%template(OpaqueVectorType) std::vector<A::OpaqueType>;