%module std_containers // // STL containers test suite. // Tests: // std::complex, std::string, std::vector, std::set, std::deque, // std::pair, std::map, std::multiset, std::multimap and IN/OUT functions // for them, with C++ types. // %{ #include %} %include std_vector.i %include std_string.i %include std_deque.i %include std_list.i %include std_set.i %include std_multiset.i %include std_pair.i %include std_map.i %include std_multimap.i %include std_complex.i %template() std::vector; %template() std::pair; %template() std::pair; %template() std::vector< std::vector > ; %template(ccube) std::vector< std::vector< std::vector > >; %inline { typedef std::vector > > ccube; ccube cident(const ccube& c) { return c; } struct C { }; } %template(map_si) std::map; %template(pair_iC) std::pair; %template(map_iC) std::map; %template(mmap_si) std::multimap; %template(set_i) std::set; %template(multiset_i) std::multiset; %template(list_i) std::list; %template(deque_i) std::deque; %template(vector_b) std::vector; %template(vector_i) std::vector; %template(vector_c) std::vector >; %template(vector_ui) std::vector; %template(bmatrix) std::vector >; %template(imatrix) std::vector >; %template(cmatrix) std::vector > >; %apply std::vector *INOUT {std::vector *INOUT2}; %inline { typedef std::vector > imatrix; imatrix midenti(const imatrix& v) { return v; } typedef std::vector > bmatrix; bmatrix midentb(const bmatrix& v) { return v; } std::map mapidentc(const std::map& v) { return v; } std::map mapidenti(const std::map& v) { return v; } std::map mapident(const std::map& v) { return v; } std::multimap mapident(const std::multimap& v) { return v; } std::vector vident(const std::vector& v) { return v; } std::set sident(const std::set& v) { return v; } std::vector videntu(const std::vector& v) { return v; } std::vector videntb(const std::vector& v) { return v; } int get_elem(const std::vector& v, int index) { return v[index]; } std::pair pident(const std::pair& p) { return p; } void v_inout(std::vector *INOUT) { *INOUT = *INOUT; } void v_inout2(std::vector *INOUT, std::vector *INOUT2) { std::swap(*INOUT, *INOUT2); } } %{ template struct Param { }; %} template struct Param { }; %template(Param_c) Param >; %inline { int hello(Param > c) { return 0; } } %inline { struct A { A(int aa = 0) : a(aa) { } int a; }; } %template() std::pair; %template(pair_iA) std::pair; %template(vector_piA) std::vector >; %inline { std::pair ident(std::pair a, const std::pair& b) { return std::pair(); } std::vector > pia_vident(std::vector > a ) { return a; } struct Foo { int x; Foo(int i) : x(i) { } }; } %std_nodefconst_type(Foo); %template(vector_Foo) std::vector; %template(deque_Foo) std::deque; %template(list_Foo) std::list;