Mercurial > mm7
comparison lib/swig/swigwin-2.0.11/Lib/std/std_set.i @ 1899:b3009adc0e2f
Adding swig, gitignore, hgignore
author | Nomad |
---|---|
date | Mon, 21 Oct 2013 10:42:27 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1867:eb580660bbbb | 1899:b3009adc0e2f |
---|---|
1 // | |
2 // std::set | |
3 // | |
4 | |
5 %include <std_container.i> | |
6 %include <std_pair.i> | |
7 | |
8 // Set | |
9 %define %std_set_methods_common(set...) | |
10 set(); | |
11 set( const set& ); | |
12 | |
13 bool empty() const; | |
14 size_type size() const; | |
15 void clear(); | |
16 | |
17 void swap(set& v); | |
18 | |
19 | |
20 size_type erase(const key_type& x); | |
21 size_type count(const key_type& x) const; | |
22 | |
23 #ifdef SWIG_EXPORT_ITERATOR_METHODS | |
24 class iterator; | |
25 class reverse_iterator; | |
26 | |
27 iterator begin(); | |
28 iterator end(); | |
29 reverse_iterator rbegin(); | |
30 reverse_iterator rend(); | |
31 | |
32 void erase(iterator pos); | |
33 void erase(iterator first, iterator last); | |
34 | |
35 iterator find(const key_type& x); | |
36 iterator lower_bound(const key_type& x); | |
37 iterator upper_bound(const key_type& x); | |
38 std::pair<iterator,iterator> equal_range(const key_type& x); | |
39 #endif | |
40 %enddef | |
41 | |
42 %define %std_set_methods(set...) | |
43 %std_set_methods_common(set); | |
44 #ifdef SWIG_EXPORT_ITERATOR_METHODS | |
45 std::pair<iterator,bool> insert(const value_type& __x); | |
46 #endif | |
47 %enddef | |
48 | |
49 // ------------------------------------------------------------------------ | |
50 // std::set | |
51 // | |
52 // const declarations are used to guess the intent of the function being | |
53 // exported; therefore, the following rationale is applied: | |
54 // | |
55 // -- f(std::set<T>), f(const std::set<T>&): | |
56 // the parameter being read-only, either a sequence or a | |
57 // previously wrapped std::set<T> can be passed. | |
58 // -- f(std::set<T>&), f(std::set<T>*): | |
59 // the parameter may be modified; therefore, only a wrapped std::set | |
60 // can be passed. | |
61 // -- std::set<T> f(), const std::set<T>& f(): | |
62 // the set is returned by copy; therefore, a sequence of T:s | |
63 // is returned which is most easily used in other functions | |
64 // -- std::set<T>& f(), std::set<T>* f(): | |
65 // the set is returned by reference; therefore, a wrapped std::set | |
66 // is returned | |
67 // -- const std::set<T>* f(), f(const std::set<T>*): | |
68 // for consistency, they expect and return a plain set pointer. | |
69 // ------------------------------------------------------------------------ | |
70 | |
71 %{ | |
72 #include <set> | |
73 %} | |
74 | |
75 // exported classes | |
76 | |
77 namespace std { | |
78 | |
79 template <class _Key, class _Compare = std::less<_Key>, | |
80 class _Alloc = allocator<_Key> > | |
81 class set { | |
82 public: | |
83 typedef size_t size_type; | |
84 typedef ptrdiff_t difference_type; | |
85 typedef _Key value_type; | |
86 typedef _Key key_type; | |
87 typedef value_type* pointer; | |
88 typedef const value_type* const_pointer; | |
89 typedef value_type& reference; | |
90 typedef const value_type& const_reference; | |
91 typedef _Alloc allocator_type; | |
92 | |
93 %traits_swigtype(_Key); | |
94 | |
95 %fragment(SWIG_Traits_frag(std::set<_Key, _Compare, _Alloc >), "header", | |
96 fragment=SWIG_Traits_frag(_Key), | |
97 fragment="StdSetTraits") { | |
98 namespace swig { | |
99 template <> struct traits<std::set<_Key, _Compare, _Alloc > > { | |
100 typedef pointer_category category; | |
101 static const char* type_name() { | |
102 return "std::set<" #_Key "," #_Compare "," #_Alloc " >"; | |
103 } | |
104 }; | |
105 } | |
106 } | |
107 | |
108 %typemap_traits_ptr(SWIG_TYPECHECK_SET, std::set<_Key, _Compare, _Alloc >); | |
109 | |
110 set( const _Compare& ); | |
111 | |
112 #ifdef %swig_set_methods | |
113 // Add swig/language extra methods | |
114 %swig_set_methods(std::set<_Key, _Compare, _Alloc >); | |
115 #endif | |
116 | |
117 %std_set_methods(set); | |
118 }; | |
119 } |