PageRenderTime 40ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/Lib/ruby/std_multiset.i

#
Swig | 50 lines | 37 code | 10 blank | 3 comment | 0 complexity | a908a0efe5e1173953cf7605ca23a2a9 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. /*
  2. Multisets
  3. */
  4. %include <std_set.i>
  5. %fragment("StdMultisetTraits","header",fragment="StdSequenceTraits")
  6. %{
  7. namespace swig {
  8. template <class RubySeq, class T>
  9. inline void
  10. assign(const RubySeq& rubyseq, std::multiset<T>* seq) {
  11. // seq->insert(rubyseq.begin(), rubyseq.end()); // not used as not always implemented
  12. typedef typename RubySeq::value_type value_type;
  13. typename RubySeq::const_iterator it = rubyseq.begin();
  14. for (;it != rubyseq.end(); ++it) {
  15. seq->insert(seq->end(),(value_type)(*it));
  16. }
  17. }
  18. template <class T>
  19. struct traits_asptr<std::multiset<T> > {
  20. static int asptr(VALUE obj, std::multiset<T> **m) {
  21. return traits_asptr_stdseq<std::multiset<T> >::asptr(obj, m);
  22. }
  23. };
  24. template <class T>
  25. struct traits_from<std::multiset<T> > {
  26. static VALUE from(const std::multiset<T>& vec) {
  27. return traits_from_stdseq<std::multiset<T> >::from(vec);
  28. }
  29. };
  30. }
  31. %}
  32. #define %swig_multiset_methods(Set...) %swig_set_methods(Set)
  33. %rename("delete") std::multiset::__delete__;
  34. %rename("reject!") std::multiset::reject_bang;
  35. %rename("map!") std::multiset::map_bang;
  36. %rename("empty?") std::multiset::empty;
  37. %rename("include?" ) std::multiset::__contains__ const;
  38. %rename("has_key?" ) std::multiset::has_key const;
  39. %alias std::multiset::push "<<";
  40. %include <std/std_multiset.i>