1 /* 2 Multisets 3 */ 4 5 %include <std_set.i> 6 7 %fragment("StdMultisetTraits","header",fragment="StdSequenceTraits") 8 %{ 9 namespace swig { 10 template <class SwigPySeq, class T> 11 inline void 12 assign(const SwigPySeq& swigpyseq, std::multiset<T>* seq) { 13 // seq->insert(swigpyseq.begin(), swigpyseq.end()); // not used as not always implemented 14 typedef typename SwigPySeq::value_type value_type; 15 typename SwigPySeq::const_iterator it = swigpyseq.begin(); 16 for (;it != swigpyseq.end(); ++it) { 17 seq->insert(seq->end(),(value_type)(*it)); 18 } 19 } 20 21 template <class T> 22 struct traits_asptr<std::multiset<T> > { 23 static int asptr(PyObject *obj, std::multiset<T> **m) { 24 return traits_asptr_stdseq<std::multiset<T> >::asptr(obj, m); 25 } 26 }; 27 28 template <class T> 29 struct traits_from<std::multiset<T> > { 30 static PyObject *from(const std::multiset<T>& vec) { 31 return traits_from_stdseq<std::multiset<T> >::from(vec); 32 } 33 }; 34 } 35 %} 36 37 #define %swig_multiset_methods(Set...) %swig_set_methods(Set) 38 39 40 41 %include <std/std_multiset.i> 42