/tags/rel-1-3-26/SWIG/Examples/test-suite/python/template_matrix.i
Swig | 71 lines | 50 code | 21 blank | 0 comment | 0 complexity | 68fe073e8a0566884195a3fc80a38f6a MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
1%module template_matrix 2%{ 3#include <vector> 4 5 struct pop 6 { 7 }; 8 9%} 10 11%include "std_vector.i" 12 13 14%inline { 15namespace simuPOP 16{ 17 struct POP 18 { 19 }; 20 21 template<class _POP1, class _POP2 = POP> 22 class Operator 23 { 24 }; 25} 26 27} 28 29%template(vectorop) std::vector< simuPOP::Operator<pop> >; 30 31 32 33namespace simuPOP 34{ 35 %template(baseOperator) Operator<pop>; 36} 37 38 39#if 1 40 41namespace std 42{ 43%template(vectori) vector<int>; 44%template(matrixi) vector< vector<int> >; 45%template(cubei) vector< vector< vector<int> > >; 46} 47 48 49 50%inline %{ 51std::vector<int> 52passVector(const std::vector<int>& a) 53{ 54 return a; 55} 56 57std::vector< std::vector<int> > 58passMatrix(const std::vector< std::vector<int> >& a) 59{ 60 return a; 61} 62 63std::vector< std::vector< std::vector<int> > > 64passCube(const std::vector< std::vector< std::vector<int> > >& a) 65{ 66 return a; 67} 68 69%} 70 71#endif