PageRenderTime 6ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 1ms

/trunk/Lib/ruby/std_multiset.i

#
Swig | 50 lines | 37 code | 10 blank | 3 comment | 0 complexity | a908a0efe5e1173953cf7605ca23a2a9 MD5 | raw file
 1/*
 2  Multisets
 3*/
 4
 5%include <std_set.i>
 6
 7%fragment("StdMultisetTraits","header",fragment="StdSequenceTraits")
 8%{
 9  namespace swig {
10    template <class RubySeq, class T> 
11    inline void
12    assign(const RubySeq& rubyseq, std::multiset<T>* seq) {
13      // seq->insert(rubyseq.begin(), rubyseq.end()); // not used as not always implemented
14      typedef typename RubySeq::value_type value_type;
15      typename RubySeq::const_iterator it = rubyseq.begin();
16      for (;it != rubyseq.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(VALUE 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 VALUE 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%rename("delete")     std::multiset::__delete__;
42%rename("reject!")    std::multiset::reject_bang;
43%rename("map!")       std::multiset::map_bang;
44%rename("empty?")     std::multiset::empty;
45%rename("include?" )  std::multiset::__contains__ const;
46%rename("has_key?" )  std::multiset::has_key const;
47
48%alias  std::multiset::push          "<<";
49
50%include <std/std_multiset.i>