williamr@4
|
1 |
/*
|
williamr@4
|
2 |
*
|
williamr@4
|
3 |
* Copyright (c) 1994
|
williamr@4
|
4 |
* Hewlett-Packard Company
|
williamr@4
|
5 |
*
|
williamr@4
|
6 |
* Copyright (c) 1996,1997
|
williamr@4
|
7 |
* Silicon Graphics Computer Systems, Inc.
|
williamr@4
|
8 |
*
|
williamr@4
|
9 |
* Copyright (c) 1997
|
williamr@4
|
10 |
* Moscow Center for SPARC Technology
|
williamr@4
|
11 |
*
|
williamr@4
|
12 |
* Copyright (c) 1999
|
williamr@4
|
13 |
* Boris Fomitchev
|
williamr@4
|
14 |
*
|
williamr@4
|
15 |
* This material is provided "as is", with absolutely no warranty expressed
|
williamr@4
|
16 |
* or implied. Any use is at your own risk.
|
williamr@4
|
17 |
*
|
williamr@4
|
18 |
* Permission to use or copy this software for any purpose is hereby granted
|
williamr@4
|
19 |
* without fee, provided the above notices are retained on all copies.
|
williamr@4
|
20 |
* Permission to modify the code and to distribute modified code is granted,
|
williamr@4
|
21 |
* provided the above notices are retained, and a notice that the code was
|
williamr@4
|
22 |
* modified is included with the above copyright notice.
|
williamr@4
|
23 |
*
|
williamr@4
|
24 |
*/
|
williamr@4
|
25 |
|
williamr@4
|
26 |
/* NOTE: This is an internal header file, included by other STL headers.
|
williamr@4
|
27 |
* You should not attempt to use it directly.
|
williamr@4
|
28 |
*/
|
williamr@4
|
29 |
|
williamr@4
|
30 |
#ifndef _STLP_INTERNAL_SET_H
|
williamr@4
|
31 |
#define _STLP_INTERNAL_SET_H
|
williamr@4
|
32 |
|
williamr@4
|
33 |
#ifndef _STLP_INTERNAL_TREE_H
|
williamr@4
|
34 |
# include <stl/_tree.h>
|
williamr@4
|
35 |
#endif
|
williamr@4
|
36 |
|
williamr@4
|
37 |
#if !defined (_STLP_USE_PTR_SPECIALIZATIONS)
|
williamr@4
|
38 |
|
williamr@4
|
39 |
_STLP_BEGIN_NAMESPACE
|
williamr@4
|
40 |
|
williamr@4
|
41 |
//Specific iterator traits creation
|
williamr@4
|
42 |
_STLP_CREATE_ITERATOR_TRAITS(SetTraitsT, Const_traits)
|
williamr@4
|
43 |
|
williamr@4
|
44 |
template <class _Key, _STLP_DFL_TMPL_PARAM(_Compare, less<_Key>),
|
williamr@4
|
45 |
_STLP_DEFAULT_ALLOCATOR_SELECT(_Key) >
|
williamr@4
|
46 |
class set
|
williamr@4
|
47 |
#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
|
williamr@4
|
48 |
: public __stlport_class<set<_Key, _Compare, _Alloc> >
|
williamr@4
|
49 |
#endif
|
williamr@4
|
50 |
{
|
williamr@4
|
51 |
typedef set<_Key, _Compare, _Alloc> _Self;
|
williamr@4
|
52 |
public:
|
williamr@4
|
53 |
// typedefs:
|
williamr@4
|
54 |
typedef _Key key_type;
|
williamr@4
|
55 |
typedef _Key value_type;
|
williamr@4
|
56 |
typedef _Compare key_compare;
|
williamr@4
|
57 |
typedef _Compare value_compare;
|
williamr@4
|
58 |
|
williamr@4
|
59 |
private:
|
williamr@4
|
60 |
//Specific iterator traits creation
|
williamr@4
|
61 |
typedef _STLP_PRIV _SetTraitsT<value_type> _SetTraits;
|
williamr@4
|
62 |
|
williamr@4
|
63 |
public:
|
williamr@4
|
64 |
//Following typedef have to be public for __move_traits specialization.
|
williamr@4
|
65 |
typedef _STLP_PRIV _Rb_tree<key_type, key_compare,
|
williamr@4
|
66 |
value_type, _STLP_PRIV _Identity<value_type>,
|
williamr@4
|
67 |
_SetTraits, _Alloc> _Rep_type;
|
williamr@4
|
68 |
|
williamr@4
|
69 |
typedef typename _Rep_type::pointer pointer;
|
williamr@4
|
70 |
typedef typename _Rep_type::const_pointer const_pointer;
|
williamr@4
|
71 |
typedef typename _Rep_type::reference reference;
|
williamr@4
|
72 |
typedef typename _Rep_type::const_reference const_reference;
|
williamr@4
|
73 |
typedef typename _Rep_type::iterator iterator;
|
williamr@4
|
74 |
typedef typename _Rep_type::const_iterator const_iterator;
|
williamr@4
|
75 |
typedef typename _Rep_type::reverse_iterator reverse_iterator;
|
williamr@4
|
76 |
typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
|
williamr@4
|
77 |
typedef typename _Rep_type::size_type size_type;
|
williamr@4
|
78 |
typedef typename _Rep_type::difference_type difference_type;
|
williamr@4
|
79 |
typedef typename _Rep_type::allocator_type allocator_type;
|
williamr@4
|
80 |
|
williamr@4
|
81 |
private:
|
williamr@4
|
82 |
_Rep_type _M_t; // red-black tree representing set
|
williamr@4
|
83 |
_STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
|
williamr@4
|
84 |
|
williamr@4
|
85 |
public:
|
williamr@4
|
86 |
|
williamr@4
|
87 |
// allocation/deallocation
|
williamr@4
|
88 |
#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
|
williamr@4
|
89 |
explicit set(const _Compare& __comp = _Compare(),
|
williamr@4
|
90 |
const allocator_type& __a = allocator_type())
|
williamr@4
|
91 |
#else
|
williamr@4
|
92 |
set()
|
williamr@4
|
93 |
: _M_t(_Compare(), allocator_type()) {}
|
williamr@4
|
94 |
explicit set(const _Compare& __comp)
|
williamr@4
|
95 |
: _M_t(__comp, allocator_type()) {}
|
williamr@4
|
96 |
set(const _Compare& __comp, const allocator_type& __a)
|
williamr@4
|
97 |
#endif
|
williamr@4
|
98 |
: _M_t(__comp, __a) {}
|
williamr@4
|
99 |
|
williamr@4
|
100 |
#if defined (_STLP_MEMBER_TEMPLATES)
|
williamr@4
|
101 |
template <class _InputIterator>
|
williamr@4
|
102 |
set(_InputIterator __first, _InputIterator __last)
|
williamr@4
|
103 |
: _M_t(_Compare(), allocator_type())
|
williamr@4
|
104 |
{ _M_t.insert_unique(__first, __last); }
|
williamr@4
|
105 |
|
williamr@4
|
106 |
# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
|
williamr@4
|
107 |
template <class _InputIterator>
|
williamr@4
|
108 |
set(_InputIterator __first, _InputIterator __last, const _Compare& __comp)
|
williamr@4
|
109 |
: _M_t(__comp, allocator_type()) { _M_t.insert_unique(__first, __last); }
|
williamr@4
|
110 |
# endif
|
williamr@4
|
111 |
template <class _InputIterator>
|
williamr@4
|
112 |
set(_InputIterator __first, _InputIterator __last, const _Compare& __comp,
|
williamr@4
|
113 |
const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
|
williamr@4
|
114 |
: _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
|
williamr@4
|
115 |
#else
|
williamr@4
|
116 |
set(const value_type* __first, const value_type* __last)
|
williamr@4
|
117 |
: _M_t(_Compare(), allocator_type())
|
williamr@4
|
118 |
{ _M_t.insert_unique(__first, __last); }
|
williamr@4
|
119 |
|
williamr@4
|
120 |
set(const value_type* __first,
|
williamr@4
|
121 |
const value_type* __last, const _Compare& __comp,
|
williamr@4
|
122 |
const allocator_type& __a = allocator_type())
|
williamr@4
|
123 |
: _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
|
williamr@4
|
124 |
|
williamr@4
|
125 |
set(const_iterator __first, const_iterator __last)
|
williamr@4
|
126 |
: _M_t(_Compare(), allocator_type())
|
williamr@4
|
127 |
{ _M_t.insert_unique(__first, __last); }
|
williamr@4
|
128 |
|
williamr@4
|
129 |
set(const_iterator __first, const_iterator __last, const _Compare& __comp,
|
williamr@4
|
130 |
const allocator_type& __a = allocator_type())
|
williamr@4
|
131 |
: _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
|
williamr@4
|
132 |
#endif /* _STLP_MEMBER_TEMPLATES */
|
williamr@4
|
133 |
|
williamr@4
|
134 |
set(const _Self& __x) : _M_t(__x._M_t) {}
|
williamr@4
|
135 |
|
williamr@4
|
136 |
set(__move_source<_Self> src)
|
williamr@4
|
137 |
: _M_t(__move_source<_Rep_type>(src.get()._M_t)) {}
|
williamr@4
|
138 |
|
williamr@4
|
139 |
_Self& operator=(const _Self& __x) {
|
williamr@4
|
140 |
_M_t = __x._M_t;
|
williamr@4
|
141 |
return *this;
|
williamr@4
|
142 |
}
|
williamr@4
|
143 |
|
williamr@4
|
144 |
// accessors:
|
williamr@4
|
145 |
key_compare key_comp() const { return _M_t.key_comp(); }
|
williamr@4
|
146 |
value_compare value_comp() const { return _M_t.key_comp(); }
|
williamr@4
|
147 |
allocator_type get_allocator() const { return _M_t.get_allocator(); }
|
williamr@4
|
148 |
|
williamr@4
|
149 |
iterator begin() { return _M_t.begin(); }
|
williamr@4
|
150 |
iterator end() { return _M_t.end(); }
|
williamr@4
|
151 |
const_iterator begin() const { return _M_t.begin(); }
|
williamr@4
|
152 |
const_iterator end() const { return _M_t.end(); }
|
williamr@4
|
153 |
reverse_iterator rbegin() { return _M_t.rbegin(); }
|
williamr@4
|
154 |
reverse_iterator rend() { return _M_t.rend(); }
|
williamr@4
|
155 |
const_reverse_iterator rbegin() const { return _M_t.rbegin(); }
|
williamr@4
|
156 |
const_reverse_iterator rend() const { return _M_t.rend(); }
|
williamr@4
|
157 |
bool empty() const { return _M_t.empty(); }
|
williamr@4
|
158 |
size_type size() const { return _M_t.size(); }
|
williamr@4
|
159 |
size_type max_size() const { return _M_t.max_size(); }
|
williamr@4
|
160 |
void swap(_Self& __x) { _M_t.swap(__x._M_t); }
|
williamr@4
|
161 |
|
williamr@4
|
162 |
// insert/erase
|
williamr@4
|
163 |
pair<iterator,bool> insert(const value_type& __x)
|
williamr@4
|
164 |
{ return _M_t.insert_unique(__x); }
|
williamr@4
|
165 |
iterator insert(iterator __pos, const value_type& __x)
|
williamr@4
|
166 |
{ return _M_t.insert_unique( __pos , __x); }
|
williamr@4
|
167 |
#if defined (_STLP_MEMBER_TEMPLATES)
|
williamr@4
|
168 |
template <class _InputIterator>
|
williamr@4
|
169 |
void insert(_InputIterator __first, _InputIterator __last)
|
williamr@4
|
170 |
{ _M_t.insert_unique(__first, __last); }
|
williamr@4
|
171 |
#else
|
williamr@4
|
172 |
void insert(const_iterator __first, const_iterator __last)
|
williamr@4
|
173 |
{ _M_t.insert_unique(__first, __last); }
|
williamr@4
|
174 |
void insert(const value_type* __first, const value_type* __last)
|
williamr@4
|
175 |
{ _M_t.insert_unique(__first, __last); }
|
williamr@4
|
176 |
#endif /* _STLP_MEMBER_TEMPLATES */
|
williamr@4
|
177 |
void erase(iterator __pos) { _M_t.erase( __pos ); }
|
williamr@4
|
178 |
size_type erase(const key_type& __x) { return _M_t.erase_unique(__x); }
|
williamr@4
|
179 |
void erase(iterator __first, iterator __last) { _M_t.erase(__first, __last ); }
|
williamr@4
|
180 |
void clear() { _M_t.clear(); }
|
williamr@4
|
181 |
|
williamr@4
|
182 |
// set operations:
|
williamr@4
|
183 |
_STLP_TEMPLATE_FOR_CONT_EXT
|
williamr@4
|
184 |
const_iterator find(const _KT& __x) const { return _M_t.find(__x); }
|
williamr@4
|
185 |
_STLP_TEMPLATE_FOR_CONT_EXT
|
williamr@4
|
186 |
iterator find(const _KT& __x) { return _M_t.find(__x); }
|
williamr@4
|
187 |
_STLP_TEMPLATE_FOR_CONT_EXT
|
williamr@4
|
188 |
size_type count(const _KT& __x) const
|
williamr@4
|
189 |
{ return _M_t.find(__x) == _M_t.end() ? 0 : 1 ; }
|
williamr@4
|
190 |
_STLP_TEMPLATE_FOR_CONT_EXT
|
williamr@4
|
191 |
iterator lower_bound(const _KT& __x) { return _M_t.lower_bound(__x); }
|
williamr@4
|
192 |
_STLP_TEMPLATE_FOR_CONT_EXT
|
williamr@4
|
193 |
const_iterator lower_bound(const _KT& __x) const { return _M_t.lower_bound(__x); }
|
williamr@4
|
194 |
_STLP_TEMPLATE_FOR_CONT_EXT
|
williamr@4
|
195 |
iterator upper_bound(const _KT& __x) { return _M_t.upper_bound(__x); }
|
williamr@4
|
196 |
_STLP_TEMPLATE_FOR_CONT_EXT
|
williamr@4
|
197 |
const_iterator upper_bound(const _KT& __x) const { return _M_t.upper_bound(__x); }
|
williamr@4
|
198 |
_STLP_TEMPLATE_FOR_CONT_EXT
|
williamr@4
|
199 |
pair<iterator, iterator> equal_range(const _KT& __x)
|
williamr@4
|
200 |
{ return _M_t.equal_range_unique(__x); }
|
williamr@4
|
201 |
_STLP_TEMPLATE_FOR_CONT_EXT
|
williamr@4
|
202 |
pair<const_iterator, const_iterator> equal_range(const _KT& __x) const
|
williamr@4
|
203 |
{ return _M_t.equal_range_unique(__x); }
|
williamr@4
|
204 |
};
|
williamr@4
|
205 |
|
williamr@4
|
206 |
//Specific iterator traits creation
|
williamr@4
|
207 |
_STLP_CREATE_ITERATOR_TRAITS(MultisetTraitsT, Const_traits)
|
williamr@4
|
208 |
|
williamr@4
|
209 |
template <class _Key, _STLP_DFL_TMPL_PARAM(_Compare, less<_Key>),
|
williamr@4
|
210 |
_STLP_DEFAULT_ALLOCATOR_SELECT(_Key) >
|
williamr@4
|
211 |
class multiset
|
williamr@4
|
212 |
#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
|
williamr@4
|
213 |
: public __stlport_class<multiset<_Key, _Compare, _Alloc> >
|
williamr@4
|
214 |
#endif
|
williamr@4
|
215 |
{
|
williamr@4
|
216 |
typedef multiset<_Key, _Compare, _Alloc> _Self;
|
williamr@4
|
217 |
public:
|
williamr@4
|
218 |
// typedefs:
|
williamr@4
|
219 |
|
williamr@4
|
220 |
typedef _Key key_type;
|
williamr@4
|
221 |
typedef _Key value_type;
|
williamr@4
|
222 |
typedef _Compare key_compare;
|
williamr@4
|
223 |
typedef _Compare value_compare;
|
williamr@4
|
224 |
|
williamr@4
|
225 |
private:
|
williamr@4
|
226 |
//Specific iterator traits creation
|
williamr@4
|
227 |
typedef _STLP_PRIV _MultisetTraitsT<value_type> _MultisetTraits;
|
williamr@4
|
228 |
|
williamr@4
|
229 |
public:
|
williamr@4
|
230 |
//Following typedef have to be public for __move_traits specialization.
|
williamr@4
|
231 |
typedef _STLP_PRIV _Rb_tree<key_type, key_compare,
|
williamr@4
|
232 |
value_type, _STLP_PRIV _Identity<value_type>,
|
williamr@4
|
233 |
_MultisetTraits, _Alloc> _Rep_type;
|
williamr@4
|
234 |
|
williamr@4
|
235 |
typedef typename _Rep_type::pointer pointer;
|
williamr@4
|
236 |
typedef typename _Rep_type::const_pointer const_pointer;
|
williamr@4
|
237 |
typedef typename _Rep_type::reference reference;
|
williamr@4
|
238 |
typedef typename _Rep_type::const_reference const_reference;
|
williamr@4
|
239 |
typedef typename _Rep_type::iterator iterator;
|
williamr@4
|
240 |
typedef typename _Rep_type::const_iterator const_iterator;
|
williamr@4
|
241 |
typedef typename _Rep_type::reverse_iterator reverse_iterator;
|
williamr@4
|
242 |
typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
|
williamr@4
|
243 |
typedef typename _Rep_type::size_type size_type;
|
williamr@4
|
244 |
typedef typename _Rep_type::difference_type difference_type;
|
williamr@4
|
245 |
typedef typename _Rep_type::allocator_type allocator_type;
|
williamr@4
|
246 |
|
williamr@4
|
247 |
private:
|
williamr@4
|
248 |
_Rep_type _M_t; // red-black tree representing multiset
|
williamr@4
|
249 |
_STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
|
williamr@4
|
250 |
|
williamr@4
|
251 |
public:
|
williamr@4
|
252 |
#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
|
williamr@4
|
253 |
explicit multiset(const _Compare& __comp = _Compare(),
|
williamr@4
|
254 |
const allocator_type& __a = allocator_type())
|
williamr@4
|
255 |
#else
|
williamr@4
|
256 |
multiset()
|
williamr@4
|
257 |
: _M_t(_Compare(), allocator_type()) {}
|
williamr@4
|
258 |
explicit multiset(const _Compare& __comp)
|
williamr@4
|
259 |
: _M_t(__comp, allocator_type()) {}
|
williamr@4
|
260 |
multiset(const _Compare& __comp, const allocator_type& __a)
|
williamr@4
|
261 |
#endif
|
williamr@4
|
262 |
: _M_t(__comp, __a) {}
|
williamr@4
|
263 |
|
williamr@4
|
264 |
#if defined (_STLP_MEMBER_TEMPLATES)
|
williamr@4
|
265 |
template <class _InputIterator>
|
williamr@4
|
266 |
multiset(_InputIterator __first, _InputIterator __last)
|
williamr@4
|
267 |
: _M_t(_Compare(), allocator_type())
|
williamr@4
|
268 |
{ _M_t.insert_equal(__first, __last); }
|
williamr@4
|
269 |
|
williamr@4
|
270 |
template <class _InputIterator>
|
williamr@4
|
271 |
multiset(_InputIterator __first, _InputIterator __last,
|
williamr@4
|
272 |
const _Compare& __comp,
|
williamr@4
|
273 |
const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
|
williamr@4
|
274 |
: _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
|
williamr@4
|
275 |
# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
|
williamr@4
|
276 |
template <class _InputIterator>
|
williamr@4
|
277 |
multiset(_InputIterator __first, _InputIterator __last,
|
williamr@4
|
278 |
const _Compare& __comp)
|
williamr@4
|
279 |
: _M_t(__comp, allocator_type()) { _M_t.insert_equal(__first, __last); }
|
williamr@4
|
280 |
# endif
|
williamr@4
|
281 |
#else
|
williamr@4
|
282 |
multiset(const value_type* __first, const value_type* __last)
|
williamr@4
|
283 |
: _M_t(_Compare(), allocator_type())
|
williamr@4
|
284 |
{ _M_t.insert_equal(__first, __last); }
|
williamr@4
|
285 |
|
williamr@4
|
286 |
multiset(const value_type* __first, const value_type* __last,
|
williamr@4
|
287 |
const _Compare& __comp,
|
williamr@4
|
288 |
const allocator_type& __a = allocator_type())
|
williamr@4
|
289 |
: _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
|
williamr@4
|
290 |
|
williamr@4
|
291 |
multiset(const_iterator __first, const_iterator __last)
|
williamr@4
|
292 |
: _M_t(_Compare(), allocator_type())
|
williamr@4
|
293 |
{ _M_t.insert_equal(__first, __last); }
|
williamr@4
|
294 |
|
williamr@4
|
295 |
multiset(const_iterator __first, const_iterator __last,
|
williamr@4
|
296 |
const _Compare& __comp,
|
williamr@4
|
297 |
const allocator_type& __a = allocator_type())
|
williamr@4
|
298 |
: _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
|
williamr@4
|
299 |
#endif /* _STLP_MEMBER_TEMPLATES */
|
williamr@4
|
300 |
|
williamr@4
|
301 |
multiset(const _Self& __x) : _M_t(__x._M_t) {}
|
williamr@4
|
302 |
_Self& operator=(const _Self& __x) {
|
williamr@4
|
303 |
_M_t = __x._M_t;
|
williamr@4
|
304 |
return *this;
|
williamr@4
|
305 |
}
|
williamr@4
|
306 |
|
williamr@4
|
307 |
multiset(__move_source<_Self> src)
|
williamr@4
|
308 |
: _M_t(__move_source<_Rep_type>(src.get()._M_t)) {}
|
williamr@4
|
309 |
|
williamr@4
|
310 |
// accessors:
|
williamr@4
|
311 |
key_compare key_comp() const { return _M_t.key_comp(); }
|
williamr@4
|
312 |
value_compare value_comp() const { return _M_t.key_comp(); }
|
williamr@4
|
313 |
allocator_type get_allocator() const { return _M_t.get_allocator(); }
|
williamr@4
|
314 |
|
williamr@4
|
315 |
iterator begin() { return _M_t.begin(); }
|
williamr@4
|
316 |
iterator end() { return _M_t.end(); }
|
williamr@4
|
317 |
const_iterator begin() const { return _M_t.begin(); }
|
williamr@4
|
318 |
const_iterator end() const { return _M_t.end(); }
|
williamr@4
|
319 |
reverse_iterator rbegin() { return _M_t.rbegin(); }
|
williamr@4
|
320 |
reverse_iterator rend() { return _M_t.rend(); }
|
williamr@4
|
321 |
const_reverse_iterator rbegin() const { return _M_t.rbegin(); }
|
williamr@4
|
322 |
const_reverse_iterator rend() const { return _M_t.rend(); }
|
williamr@4
|
323 |
bool empty() const { return _M_t.empty(); }
|
williamr@4
|
324 |
size_type size() const { return _M_t.size(); }
|
williamr@4
|
325 |
size_type max_size() const { return _M_t.max_size(); }
|
williamr@4
|
326 |
void swap(_Self& __x) { _M_t.swap(__x._M_t); }
|
williamr@4
|
327 |
|
williamr@4
|
328 |
// insert/erase
|
williamr@4
|
329 |
iterator insert(const value_type& __x)
|
williamr@4
|
330 |
{ return _M_t.insert_equal(__x); }
|
williamr@4
|
331 |
iterator insert(iterator __pos, const value_type& __x)
|
williamr@4
|
332 |
{ return _M_t.insert_equal(__pos, __x); }
|
williamr@4
|
333 |
|
williamr@4
|
334 |
#if defined (_STLP_MEMBER_TEMPLATES)
|
williamr@4
|
335 |
template <class _InputIterator>
|
williamr@4
|
336 |
void insert(_InputIterator __first, _InputIterator __last)
|
williamr@4
|
337 |
{ _M_t.insert_equal(__first, __last); }
|
williamr@4
|
338 |
#else
|
williamr@4
|
339 |
void insert(const value_type* __first, const value_type* __last)
|
williamr@4
|
340 |
{ _M_t.insert_equal(__first, __last); }
|
williamr@4
|
341 |
void insert(const_iterator __first, const_iterator __last)
|
williamr@4
|
342 |
{ _M_t.insert_equal(__first, __last); }
|
williamr@4
|
343 |
#endif /* _STLP_MEMBER_TEMPLATES */
|
williamr@4
|
344 |
void erase(iterator __pos) { _M_t.erase( __pos ); }
|
williamr@4
|
345 |
size_type erase(const key_type& __x) { return _M_t.erase(__x); }
|
williamr@4
|
346 |
void erase(iterator __first, iterator __last) { _M_t.erase( __first, __last ); }
|
williamr@4
|
347 |
void clear() { _M_t.clear(); }
|
williamr@4
|
348 |
|
williamr@4
|
349 |
// multiset operations:
|
williamr@4
|
350 |
_STLP_TEMPLATE_FOR_CONT_EXT
|
williamr@4
|
351 |
iterator find(const _KT& __x) { return _M_t.find(__x); }
|
williamr@4
|
352 |
_STLP_TEMPLATE_FOR_CONT_EXT
|
williamr@4
|
353 |
const_iterator find(const _KT& __x) const { return _M_t.find(__x); }
|
williamr@4
|
354 |
_STLP_TEMPLATE_FOR_CONT_EXT
|
williamr@4
|
355 |
size_type count(const _KT& __x) const { return _M_t.count(__x); }
|
williamr@4
|
356 |
_STLP_TEMPLATE_FOR_CONT_EXT
|
williamr@4
|
357 |
iterator lower_bound(const _KT& __x) { return _M_t.lower_bound(__x); }
|
williamr@4
|
358 |
_STLP_TEMPLATE_FOR_CONT_EXT
|
williamr@4
|
359 |
const_iterator lower_bound(const _KT& __x) const { return _M_t.lower_bound(__x); }
|
williamr@4
|
360 |
_STLP_TEMPLATE_FOR_CONT_EXT
|
williamr@4
|
361 |
iterator upper_bound(const _KT& __x) { return _M_t.upper_bound(__x); }
|
williamr@4
|
362 |
_STLP_TEMPLATE_FOR_CONT_EXT
|
williamr@4
|
363 |
const_iterator upper_bound(const _KT& __x) const { return _M_t.upper_bound(__x); }
|
williamr@4
|
364 |
_STLP_TEMPLATE_FOR_CONT_EXT
|
williamr@4
|
365 |
pair<iterator, iterator> equal_range(const _KT& __x) { return _M_t.equal_range(__x); }
|
williamr@4
|
366 |
_STLP_TEMPLATE_FOR_CONT_EXT
|
williamr@4
|
367 |
pair<const_iterator, const_iterator> equal_range(const _KT& __x) const { return _M_t.equal_range(__x); }
|
williamr@4
|
368 |
};
|
williamr@4
|
369 |
|
williamr@4
|
370 |
#else
|
williamr@4
|
371 |
# include <stl/pointers/_set.h>
|
williamr@4
|
372 |
_STLP_BEGIN_NAMESPACE
|
williamr@4
|
373 |
#endif /* _STLP_USE_PTR_SPECIALIZATIONS */
|
williamr@4
|
374 |
|
williamr@4
|
375 |
#define _STLP_TEMPLATE_HEADER template <class _Key, class _Compare, class _Alloc>
|
williamr@4
|
376 |
#define _STLP_TEMPLATE_CONTAINER set<_Key,_Compare,_Alloc>
|
williamr@4
|
377 |
#include <stl/_relops_cont.h>
|
williamr@4
|
378 |
#undef _STLP_TEMPLATE_CONTAINER
|
williamr@4
|
379 |
#define _STLP_TEMPLATE_CONTAINER multiset<_Key,_Compare,_Alloc>
|
williamr@4
|
380 |
#include <stl/_relops_cont.h>
|
williamr@4
|
381 |
#undef _STLP_TEMPLATE_CONTAINER
|
williamr@4
|
382 |
#undef _STLP_TEMPLATE_HEADER
|
williamr@4
|
383 |
|
williamr@4
|
384 |
#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
|
williamr@4
|
385 |
template <class _Key, class _Compare, class _Alloc>
|
williamr@4
|
386 |
struct __move_traits<set<_Key,_Compare,_Alloc> > :
|
williamr@4
|
387 |
_STLP_PRIV __move_traits_aux<typename set<_Key,_Compare,_Alloc>::_Rep_type>
|
williamr@4
|
388 |
{};
|
williamr@4
|
389 |
|
williamr@4
|
390 |
template <class _Key, class _Compare, class _Alloc>
|
williamr@4
|
391 |
struct __move_traits<multiset<_Key,_Compare,_Alloc> > :
|
williamr@4
|
392 |
_STLP_PRIV __move_traits_aux<typename multiset<_Key,_Compare,_Alloc>::_Rep_type>
|
williamr@4
|
393 |
{};
|
williamr@4
|
394 |
#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
|
williamr@4
|
395 |
|
williamr@4
|
396 |
_STLP_END_NAMESPACE
|
williamr@4
|
397 |
|
williamr@4
|
398 |
#endif /* _STLP_INTERNAL_SET_H */
|
williamr@4
|
399 |
|
williamr@4
|
400 |
// Local Variables:
|
williamr@4
|
401 |
// mode:C++
|
williamr@4
|
402 |
// End:
|