add more template+namespaces+matrix cases

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7046 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2005-03-08 06:46:15 +00:00
commit d7a45cd7a1
2 changed files with 77 additions and 0 deletions

View file

@ -0,0 +1,71 @@
%module template_matrix
%{
#include <vector>
struct pop
{
};
%}
%include "std_vector.i"
%inline {
namespace simuPOP
{
struct POP
{
};
template<class _POP1, class _POP2 = POP>
class Operator
{
};
}
}
%template(vectorop) std::vector< simuPOP::Operator<pop> >;
namespace simuPOP
{
%template(baseOperator) Operator<pop>;
}
#if 1
namespace std
{
%template(vectori) vector<int>;
%template(matrixi) vector< vector<int> >;
%template(cubei) vector< vector< vector<int> > >;
}
%inline %{
std::vector<int>
passVector(const std::vector<int>& a)
{
return a;
}
std::vector< std::vector<int> >
passMatrix(const std::vector< std::vector<int> >& a)
{
return a;
}
std::vector< std::vector< std::vector<int> > >
passCube(const std::vector< std::vector< std::vector<int> > >& a)
{
return a;
}
%}
#endif

View file

@ -0,0 +1,6 @@
from template_matrix import *
passVector([1,2,3])
passMatrix([[1,2],[1,2,3]])
passCube([[[1,2],[1,2,3]],[[1,2],[1,2,3]]])