diff --git a/SWIG/Examples/test-suite/python/template_matrix.i b/SWIG/Examples/test-suite/python/template_matrix.i new file mode 100644 index 000000000..27696542a --- /dev/null +++ b/SWIG/Examples/test-suite/python/template_matrix.i @@ -0,0 +1,71 @@ +%module template_matrix +%{ +#include + + struct pop + { + }; + +%} + +%include "std_vector.i" + + +%inline { +namespace simuPOP +{ + struct POP + { + }; + + template + class Operator + { + }; +} + +} + +%template(vectorop) std::vector< simuPOP::Operator >; + + + +namespace simuPOP +{ + %template(baseOperator) Operator; +} + + +#if 1 + +namespace std +{ +%template(vectori) vector; +%template(matrixi) vector< vector >; +%template(cubei) vector< vector< vector > >; +} + + + +%inline %{ +std::vector +passVector(const std::vector& a) +{ + return a; +} + +std::vector< std::vector > +passMatrix(const std::vector< std::vector >& a) +{ + return a; +} + +std::vector< std::vector< std::vector > > +passCube(const std::vector< std::vector< std::vector > >& a) +{ + return a; +} + +%} + +#endif diff --git a/SWIG/Examples/test-suite/python/template_matrix_runme.py b/SWIG/Examples/test-suite/python/template_matrix_runme.py new file mode 100644 index 000000000..95815a068 --- /dev/null +++ b/SWIG/Examples/test-suite/python/template_matrix_runme.py @@ -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]]]) + +