Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.4 KiB

  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. #ifdef SWIG_STD_NOINSERT_TEMPLATE_STL
  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. #else
  18. seq->insert(rubyseq.begin(), rubyseq.end());
  19. #endif
  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. template <class T>
  28. struct traits_from<std::multiset<T> > {
  29. static VALUE from(const std::multiset<T>& vec) {
  30. return traits_from_stdseq<std::multiset<T> >::from(vec);
  31. }
  32. };
  33. }
  34. %}
  35. #define %swig_multiset_methods(Set...) %swig_set_methods(Set)
  36. %rename("delete") std::multiset::__delete__;
  37. %rename("reject!") std::multiset::reject_bang;
  38. %rename("map!") std::multiset::map_bang;
  39. %rename("empty?") std::multiset::empty;
  40. %rename("include?" ) std::multiset::__contains__ const;
  41. %rename("has_key?" ) std::multiset::has_key const;
  42. %alias std::multiset::push "<<";
  43. %include <std/std_multiset.i>