YkESet 0.99.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. checksums.yaml +7 -0
  2. data/CODE_OF_CONDUCT.md +74 -0
  3. data/Gemfile +7 -0
  4. data/LICENSE +21 -0
  5. data/README.md +68 -0
  6. data/Rakefile +13 -0
  7. data/bin/console +14 -0
  8. data/bin/setup +8 -0
  9. data/docs/Yk/EMMap/Iterator.html +626 -0
  10. data/docs/Yk/EMMap.html +1504 -0
  11. data/docs/Yk/EMSet/Iterator.html +626 -0
  12. data/docs/Yk/EMSet.html +1472 -0
  13. data/docs/Yk/EMap/Iterator.html +626 -0
  14. data/docs/Yk/EMap.html +1730 -0
  15. data/docs/Yk/ESet/Iterator.html +626 -0
  16. data/docs/Yk/ESet.html +1472 -0
  17. data/docs/Yk.html +126 -0
  18. data/docs/_index.html +170 -0
  19. data/docs/class_list.html +51 -0
  20. data/docs/css/common.css +1 -0
  21. data/docs/css/full_list.css +58 -0
  22. data/docs/css/style.css +496 -0
  23. data/docs/file_list.html +51 -0
  24. data/docs/frames.html +17 -0
  25. data/docs/index.html +170 -0
  26. data/docs/js/app.js +314 -0
  27. data/docs/js/full_list.js +216 -0
  28. data/docs/js/jquery.js +4 -0
  29. data/docs/method_list.html +571 -0
  30. data/docs/top-level-namespace.html +110 -0
  31. data/eset.gemspec +29 -0
  32. data/ext/Yk/.ruby-version +1 -0
  33. data/ext/Yk/.yardoc/checksums +1 -0
  34. data/ext/Yk/.yardoc/complete +0 -0
  35. data/ext/Yk/.yardoc/object_types +0 -0
  36. data/ext/Yk/.yardoc/objects/root.dat +0 -0
  37. data/ext/Yk/.yardoc/proxy_types +0 -0
  38. data/ext/Yk/Makefile +267 -0
  39. data/ext/Yk/depend +2 -0
  40. data/ext/Yk/extconf.rb +7 -0
  41. data/ext/Yk/for_yard.rb +192 -0
  42. data/ext/Yk/for_yard_product.rb +397 -0
  43. data/ext/Yk/map_tz +78 -0
  44. data/ext/Yk/set_tz +77 -0
  45. data/ext/Yk/stl_map_tz.h +1026 -0
  46. data/ext/Yk/stl_multimap_tz.h +927 -0
  47. data/ext/Yk/stl_multiset_tz.h +805 -0
  48. data/ext/Yk/stl_set_tz.h +815 -0
  49. data/ext/Yk/stl_set_tz_ruby.cpp +575 -0
  50. data/ext/Yk/stl_tree_tz.h +1865 -0
  51. data/ext/Yk/test_set.rb +115 -0
  52. data/ext/Yk/tree_tz.cc +489 -0
  53. data/ext/Yk/tz_stl_auto.cpp +84 -0
  54. data/lib/eset/version.rb +3 -0
  55. data/lib/eset.rb +7 -0
  56. metadata +101 -0
@@ -0,0 +1,805 @@
1
+ // Multiset implementation -*- C++ -*-
2
+
3
+ // Copyright (C) 2001-2013 Free Software Foundation, Inc.
4
+ //
5
+ // This file is part of the GNU ISO C++ Library. This library is free
6
+ // software; you can redistribute it and/or modify it under the
7
+ // terms of the GNU General Public License as published by the
8
+ // Free Software Foundation; either version 3, or (at your option)
9
+ // any later version.
10
+
11
+ // This library is distributed in the hope that it will be useful,
12
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ // GNU General Public License for more details.
15
+
16
+ // Under Section 7 of GPL version 3, you are granted additional
17
+ // permissions described in the GCC Runtime Library Exception, version
18
+ // 3.1, as published by the Free Software Foundation.
19
+
20
+ // You should have received a copy of the GNU General Public License and
21
+ // a copy of the GCC Runtime Library Exception along with this program;
22
+ // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23
+ // <http://www.gnu.org/licenses/>.
24
+
25
+ /*
26
+ *
27
+ * Copyright (c) 1994
28
+ * Hewlett-Packard Company
29
+ *
30
+ * Permission to use, copy, modify, distribute and sell this software
31
+ * and its documentation for any purpose is hereby granted without fee,
32
+ * provided that the above copyright notice appear in all copies and
33
+ * that both that copyright notice and this permission notice appear
34
+ * in supporting documentation. Hewlett-Packard Company makes no
35
+ * representations about the suitability of this software for any
36
+ * purpose. It is provided "as is" without express or implied warranty.
37
+ *
38
+ *
39
+ * Copyright (c) 1996
40
+ * Silicon Graphics Computer Systems, Inc.
41
+ *
42
+ * Permission to use, copy, modify, distribute and sell this software
43
+ * and its documentation for any purpose is hereby granted without fee,
44
+ * provided that the above copyright notice appear in all copies and
45
+ * that both that copyright notice and this permission notice appear
46
+ * in supporting documentation. Silicon Graphics makes no
47
+ * representations about the suitability of this software for any
48
+ * purpose. It is provided "as is" without express or implied warranty.
49
+ *
50
+ * Copyright (c) 2020
51
+ *
52
+ * Yougaein@github (Kokeji Yougain)
53
+ *
54
+ *
55
+ */
56
+
57
+ /** @file bits/stl_multiset.h
58
+ * This is an internal header file, included by other library headers.
59
+ * Do not attempt to use it directly. @headername{set}
60
+ */
61
+
62
+ #ifndef _STL_MULTISET_TZ_H
63
+ #define _STL_MULTISET_TZ_H 1
64
+
65
+ #include <bits/concept_check.h>
66
+ #if __cplusplus >= 201103L
67
+ #include <initializer_list>
68
+ #endif
69
+
70
+ namespace tz _GLIBCXX_VISIBILITY(default)
71
+ {
72
+ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
73
+
74
+ /**
75
+ * @brief A standard container made up of elements, which can be retrieved
76
+ * in logarithmic time.
77
+ *
78
+ * @ingroup associative_containers
79
+ *
80
+ *
81
+ * @tparam _Key Type of key objects.
82
+ * @tparam _Compare Comparison function object type, defaults to less<_Key>.
83
+ * @tparam _Alloc Allocator type, defaults to allocator<_Key>.
84
+ *
85
+ * Meets the requirements of a <a href="tables.html#65">container</a>, a
86
+ * <a href="tables.html#66">reversible container</a>, and an
87
+ * <a href="tables.html#69">associative container</a> (using equivalent
88
+ * keys). For a @c multiset<Key> the key_type and value_type are Key.
89
+ *
90
+ * Multisets support bidirectional iterators.
91
+ *
92
+ * The private tree data is declared exactly the same way for set and
93
+ * multiset; the distinction is made entirely in how the tree functions are
94
+ * called (*_unique versus *_equal, same as the standard).
95
+ */
96
+ template <typename _Key, typename _Compare = std::less<_Key>,
97
+ typename _Alloc = std::allocator<_Key> >
98
+ class multiset
99
+ {
100
+ // concept requirements
101
+ typedef typename _Alloc::value_type _Alloc_value_type;
102
+ __glibcxx_class_requires(_Key, _SGIAssignableConcept)
103
+ __glibcxx_class_requires4(_Compare, bool, _Key, _Key,
104
+ _BinaryFunctionConcept)
105
+ __glibcxx_class_requires2(_Key, _Alloc_value_type, _SameTypeConcept)
106
+
107
+ public:
108
+ // typedefs:
109
+ typedef _Key key_type;
110
+ typedef _Key value_type;
111
+ typedef _Compare key_compare;
112
+ typedef _Compare value_compare;
113
+ typedef _Alloc allocator_type;
114
+
115
+ private:
116
+ /// This turns a red-black tree into a [multi]set.
117
+ typedef typename _Alloc::template rebind<_Key>::other _Key_alloc_type;
118
+
119
+ typedef _Rb_tree<key_type, value_type, _Identity<value_type>,
120
+ key_compare, _Key_alloc_type> _Rep_type;
121
+ /// The actual tree structure.
122
+ public:
123
+ _Rep_type _M_t;
124
+
125
+ public:
126
+ typedef typename _Key_alloc_type::pointer pointer;
127
+ typedef typename _Key_alloc_type::const_pointer const_pointer;
128
+ typedef typename _Key_alloc_type::reference reference;
129
+ typedef typename _Key_alloc_type::const_reference const_reference;
130
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
131
+ // DR 103. set::iterator is required to be modifiable,
132
+ // but this allows modification of keys.
133
+ typedef typename _Rep_type::const_iterator iterator;
134
+ typedef typename _Rep_type::const_iterator const_iterator;
135
+ typedef typename _Rep_type::const_reverse_iterator reverse_iterator;
136
+ typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
137
+ typedef typename _Rep_type::size_type size_type;
138
+ typedef typename _Rep_type::difference_type difference_type;
139
+
140
+ // allocation/deallocation
141
+ /**
142
+ * @brief Default constructor creates no elements.
143
+ */
144
+ multiset()
145
+ : _M_t() { }
146
+
147
+ /**
148
+ * @brief Creates a %multiset with no elements.
149
+ * @param __comp Comparator to use.
150
+ * @param __a An allocator object.
151
+ */
152
+ explicit
153
+ multiset(const _Compare& __comp,
154
+ const allocator_type& __a = allocator_type())
155
+ : _M_t(__comp, _Key_alloc_type(__a)) { }
156
+
157
+ /**
158
+ * @brief Builds a %multiset from a range.
159
+ * @param __first An input iterator.
160
+ * @param __last An input iterator.
161
+ *
162
+ * Create a %multiset consisting of copies of the elements from
163
+ * [first,last). This is linear in N if the range is already sorted,
164
+ * and NlogN otherwise (where N is distance(__first,__last)).
165
+ */
166
+ template<typename _InputIterator>
167
+ multiset(_InputIterator __first, _InputIterator __last)
168
+ : _M_t()
169
+ { _M_t._M_insert_equal(__first, __last); }
170
+
171
+ /**
172
+ * @brief Builds a %multiset from a range.
173
+ * @param __first An input iterator.
174
+ * @param __last An input iterator.
175
+ * @param __comp A comparison functor.
176
+ * @param __a An allocator object.
177
+ *
178
+ * Create a %multiset consisting of copies of the elements from
179
+ * [__first,__last). This is linear in N if the range is already sorted,
180
+ * and NlogN otherwise (where N is distance(__first,__last)).
181
+ */
182
+ template<typename _InputIterator>
183
+ multiset(_InputIterator __first, _InputIterator __last,
184
+ const _Compare& __comp,
185
+ const allocator_type& __a = allocator_type())
186
+ : _M_t(__comp, _Key_alloc_type(__a))
187
+ { _M_t._M_insert_equal(__first, __last); }
188
+
189
+ /**
190
+ * @brief %Multiset copy constructor.
191
+ * @param __x A %multiset of identical element and allocator types.
192
+ *
193
+ * The newly-created %multiset uses a copy of the allocation object used
194
+ * by @a __x.
195
+ */
196
+ multiset(const multiset& __x)
197
+ : _M_t(__x._M_t) { }
198
+
199
+ #if __cplusplus >= 201103L
200
+ /**
201
+ * @brief %Multiset move constructor.
202
+ * @param __x A %multiset of identical element and allocator types.
203
+ *
204
+ * The newly-created %multiset contains the exact contents of @a __x.
205
+ * The contents of @a __x are a valid, but unspecified %multiset.
206
+ */
207
+ multiset(multiset&& __x)
208
+ noexcept(is_nothrow_copy_constructible<_Compare>::value)
209
+ : _M_t(std::move(__x._M_t)) { }
210
+
211
+ /**
212
+ * @brief Builds a %multiset from an initializer_list.
213
+ * @param __l An initializer_list.
214
+ * @param __comp A comparison functor.
215
+ * @param __a An allocator object.
216
+ *
217
+ * Create a %multiset consisting of copies of the elements from
218
+ * the list. This is linear in N if the list is already sorted,
219
+ * and NlogN otherwise (where N is @a __l.size()).
220
+ */
221
+ multiset(initializer_list<value_type> __l,
222
+ const _Compare& __comp = _Compare(),
223
+ const allocator_type& __a = allocator_type())
224
+ : _M_t(__comp, _Key_alloc_type(__a))
225
+ { _M_t._M_insert_equal(__l.begin(), __l.end()); }
226
+ #endif
227
+
228
+ /**
229
+ * @brief %Multiset assignment operator.
230
+ * @param __x A %multiset of identical element and allocator types.
231
+ *
232
+ * All the elements of @a __x are copied, but unlike the copy
233
+ * constructor, the allocator object is not copied.
234
+ */
235
+ multiset&
236
+ operator=(const multiset& __x)
237
+ {
238
+ _M_t = __x._M_t;
239
+ return *this;
240
+ }
241
+
242
+ #if __cplusplus >= 201103L
243
+ /**
244
+ * @brief %Multiset move assignment operator.
245
+ * @param __x A %multiset of identical element and allocator types.
246
+ *
247
+ * The contents of @a __x are moved into this %multiset
248
+ * (without copying). @a __x is a valid, but unspecified
249
+ * %multiset.
250
+ */
251
+ multiset&
252
+ operator=(multiset&& __x)
253
+ {
254
+ // NB: DR 1204.
255
+ // NB: DR 675.
256
+ this->clear();
257
+ this->swap(__x);
258
+ return *this;
259
+ }
260
+
261
+ /**
262
+ * @brief %Multiset list assignment operator.
263
+ * @param __l An initializer_list.
264
+ *
265
+ * This function fills a %multiset with copies of the elements in the
266
+ * initializer list @a __l.
267
+ *
268
+ * Note that the assignment completely changes the %multiset and
269
+ * that the resulting %multiset's size is the same as the number
270
+ * of elements assigned. Old data may be lost.
271
+ */
272
+ multiset&
273
+ operator=(initializer_list<value_type> __l)
274
+ {
275
+ this->clear();
276
+ this->insert(__l.begin(), __l.end());
277
+ return *this;
278
+ }
279
+ #endif
280
+
281
+ // accessors:
282
+
283
+ /// Returns the comparison object.
284
+ key_compare
285
+ key_comp() const
286
+ { return _M_t.key_comp(); }
287
+ /// Returns the comparison object.
288
+ value_compare
289
+ value_comp() const
290
+ { return _M_t.key_comp(); }
291
+ /// Returns the memory allocation object.
292
+ allocator_type
293
+ get_allocator() const _GLIBCXX_NOEXCEPT
294
+ { return allocator_type(_M_t.get_allocator()); }
295
+
296
+ /**
297
+ * Returns a read-only (constant) iterator that points to the first
298
+ * element in the %multiset. Iteration is done in ascending order
299
+ * according to the keys.
300
+ */
301
+ iterator
302
+ begin() const _GLIBCXX_NOEXCEPT
303
+ { return _M_t.begin(); }
304
+
305
+ /**
306
+ * Returns a read-only (constant) iterator that points one past the last
307
+ * element in the %multiset. Iteration is done in ascending order
308
+ * according to the keys.
309
+ */
310
+ iterator
311
+ end() const _GLIBCXX_NOEXCEPT
312
+ { return _M_t.end(); }
313
+
314
+ /**
315
+ * Returns a read-only (constant) reverse iterator that points to the
316
+ * last element in the %multiset. Iteration is done in descending order
317
+ * according to the keys.
318
+ */
319
+ reverse_iterator
320
+ rbegin() const _GLIBCXX_NOEXCEPT
321
+ { return _M_t.rbegin(); }
322
+
323
+ /**
324
+ * Returns a read-only (constant) reverse iterator that points to the
325
+ * last element in the %multiset. Iteration is done in descending order
326
+ * according to the keys.
327
+ */
328
+ reverse_iterator
329
+ rend() const _GLIBCXX_NOEXCEPT
330
+ { return _M_t.rend(); }
331
+
332
+ #if __cplusplus >= 201103L
333
+ /**
334
+ * Returns a read-only (constant) iterator that points to the first
335
+ * element in the %multiset. Iteration is done in ascending order
336
+ * according to the keys.
337
+ */
338
+ iterator
339
+ cbegin() const noexcept
340
+ { return _M_t.begin(); }
341
+
342
+ /**
343
+ * Returns a read-only (constant) iterator that points one past the last
344
+ * element in the %multiset. Iteration is done in ascending order
345
+ * according to the keys.
346
+ */
347
+ iterator
348
+ cend() const noexcept
349
+ { return _M_t.end(); }
350
+
351
+ /**
352
+ * Returns a read-only (constant) reverse iterator that points to the
353
+ * last element in the %multiset. Iteration is done in descending order
354
+ * according to the keys.
355
+ */
356
+ reverse_iterator
357
+ crbegin() const noexcept
358
+ { return _M_t.rbegin(); }
359
+
360
+ /**
361
+ * Returns a read-only (constant) reverse iterator that points to the
362
+ * last element in the %multiset. Iteration is done in descending order
363
+ * according to the keys.
364
+ */
365
+ reverse_iterator
366
+ crend() const noexcept
367
+ { return _M_t.rend(); }
368
+ #endif
369
+
370
+ /// Returns true if the %set is empty.
371
+ bool
372
+ empty() const _GLIBCXX_NOEXCEPT
373
+ { return _M_t.empty(); }
374
+
375
+ /// Returns the size of the %set.
376
+ size_type
377
+ size() const _GLIBCXX_NOEXCEPT
378
+ { return _M_t.size(); }
379
+
380
+ /// Returns the maximum size of the %set.
381
+ size_type
382
+ max_size() const _GLIBCXX_NOEXCEPT
383
+ { return _M_t.max_size(); }
384
+
385
+ /**
386
+ * @brief Swaps data with another %multiset.
387
+ * @param __x A %multiset of the same element and allocator types.
388
+ *
389
+ * This exchanges the elements between two multisets in constant time.
390
+ * (It is only swapping a pointer, an integer, and an instance of the @c
391
+ * Compare type (which itself is often stateless and empty), so it should
392
+ * be quite fast.)
393
+ * Note that the global std::swap() function is specialized such that
394
+ * std::swap(s1,s2) will feed to this function.
395
+ */
396
+ void
397
+ swap(multiset& __x)
398
+ { _M_t.swap(__x._M_t); }
399
+
400
+ // insert/erase
401
+ #if __cplusplus >= 201103L
402
+ /**
403
+ * @brief Builds and inserts an element into the %multiset.
404
+ * @param __args Arguments used to generate the element instance to be
405
+ * inserted.
406
+ * @return An iterator that points to the inserted element.
407
+ *
408
+ * This function inserts an element into the %multiset. Contrary
409
+ * to a std::set the %multiset does not rely on unique keys and thus
410
+ * multiple copies of the same element can be inserted.
411
+ *
412
+ * Insertion requires logarithmic time.
413
+ */
414
+ template<typename... _Args>
415
+ iterator
416
+ emplace(_Args&&... __args)
417
+ { return _M_t._M_emplace_equal(std::forward<_Args>(__args)...); }
418
+
419
+ /**
420
+ * @brief Builds and inserts an element into the %multiset.
421
+ * @param __pos An iterator that serves as a hint as to where the
422
+ * element should be inserted.
423
+ * @param __args Arguments used to generate the element instance to be
424
+ * inserted.
425
+ * @return An iterator that points to the inserted element.
426
+ *
427
+ * This function inserts an element into the %multiset. Contrary
428
+ * to a std::set the %multiset does not rely on unique keys and thus
429
+ * multiple copies of the same element can be inserted.
430
+ *
431
+ * Note that the first parameter is only a hint and can potentially
432
+ * improve the performance of the insertion process. A bad hint would
433
+ * cause no gains in efficiency.
434
+ *
435
+ * See http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt07ch17.html
436
+ * for more on @a hinting.
437
+ *
438
+ * Insertion requires logarithmic time (if the hint is not taken).
439
+ */
440
+ template<typename... _Args>
441
+ iterator
442
+ emplace_hint(const_iterator __pos, _Args&&... __args)
443
+ {
444
+ return _M_t._M_emplace_hint_equal(__pos,
445
+ std::forward<_Args>(__args)...);
446
+ }
447
+ #endif
448
+
449
+ /**
450
+ * @brief Inserts an element into the %multiset.
451
+ * @param __x Element to be inserted.
452
+ * @return An iterator that points to the inserted element.
453
+ *
454
+ * This function inserts an element into the %multiset. Contrary
455
+ * to a std::set the %multiset does not rely on unique keys and thus
456
+ * multiple copies of the same element can be inserted.
457
+ *
458
+ * Insertion requires logarithmic time.
459
+ */
460
+ iterator
461
+ insert(const value_type& __x)
462
+ { return _M_t._M_insert_equal(__x); }
463
+
464
+ #if __cplusplus >= 201103L
465
+ iterator
466
+ insert(value_type&& __x)
467
+ { return _M_t._M_insert_equal(std::move(__x)); }
468
+ #endif
469
+
470
+ /**
471
+ * @brief Inserts an element into the %multiset.
472
+ * @param __position An iterator that serves as a hint as to where the
473
+ * element should be inserted.
474
+ * @param __x Element to be inserted.
475
+ * @return An iterator that points to the inserted element.
476
+ *
477
+ * This function inserts an element into the %multiset. Contrary
478
+ * to a std::set the %multiset does not rely on unique keys and thus
479
+ * multiple copies of the same element can be inserted.
480
+ *
481
+ * Note that the first parameter is only a hint and can potentially
482
+ * improve the performance of the insertion process. A bad hint would
483
+ * cause no gains in efficiency.
484
+ *
485
+ * See http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt07ch17.html
486
+ * for more on @a hinting.
487
+ *
488
+ * Insertion requires logarithmic time (if the hint is not taken).
489
+ */
490
+ iterator
491
+ insert(const_iterator __position, const value_type& __x)
492
+ { return _M_t._M_insert_equal_(__position, __x); }
493
+
494
+ #if __cplusplus >= 201103L
495
+ iterator
496
+ insert(const_iterator __position, value_type&& __x)
497
+ { return _M_t._M_insert_equal_(__position, std::move(__x)); }
498
+ #endif
499
+
500
+ /**
501
+ * @brief A template function that tries to insert a range of elements.
502
+ * @param __first Iterator pointing to the start of the range to be
503
+ * inserted.
504
+ * @param __last Iterator pointing to the end of the range.
505
+ *
506
+ * Complexity similar to that of the range constructor.
507
+ */
508
+ template<typename _InputIterator>
509
+ void
510
+ insert(_InputIterator __first, _InputIterator __last)
511
+ { _M_t._M_insert_equal(__first, __last); }
512
+
513
+ #if __cplusplus >= 201103L
514
+ /**
515
+ * @brief Attempts to insert a list of elements into the %multiset.
516
+ * @param __l A std::initializer_list<value_type> of elements
517
+ * to be inserted.
518
+ *
519
+ * Complexity similar to that of the range constructor.
520
+ */
521
+ void
522
+ insert(initializer_list<value_type> __l)
523
+ { this->insert(__l.begin(), __l.end()); }
524
+ #endif
525
+
526
+ #if __cplusplus >= 201103L
527
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
528
+ // DR 130. Associative erase should return an iterator.
529
+ /**
530
+ * @brief Erases an element from a %multiset.
531
+ * @param __position An iterator pointing to the element to be erased.
532
+ * @return An iterator pointing to the element immediately following
533
+ * @a position prior to the element being erased. If no such
534
+ * element exists, end() is returned.
535
+ *
536
+ * This function erases an element, pointed to by the given iterator,
537
+ * from a %multiset. Note that this function only erases the element,
538
+ * and that if the element is itself a pointer, the pointed-to memory is
539
+ * not touched in any way. Managing the pointer is the user's
540
+ * responsibility.
541
+ */
542
+ _GLIBCXX_ABI_TAG_CXX11
543
+ iterator
544
+ erase(const_iterator __position)
545
+ { return _M_t.erase(__position); }
546
+ #else
547
+ /**
548
+ * @brief Erases an element from a %multiset.
549
+ * @param __position An iterator pointing to the element to be erased.
550
+ *
551
+ * This function erases an element, pointed to by the given iterator,
552
+ * from a %multiset. Note that this function only erases the element,
553
+ * and that if the element is itself a pointer, the pointed-to memory is
554
+ * not touched in any way. Managing the pointer is the user's
555
+ * responsibility.
556
+ */
557
+ void
558
+ erase(iterator __position)
559
+ { _M_t.erase(__position); }
560
+ #endif
561
+
562
+ /**
563
+ * @brief Erases elements according to the provided key.
564
+ * @param __x Key of element to be erased.
565
+ * @return The number of elements erased.
566
+ *
567
+ * This function erases all elements located by the given key from a
568
+ * %multiset.
569
+ * Note that this function only erases the element, and that if
570
+ * the element is itself a pointer, the pointed-to memory is not touched
571
+ * in any way. Managing the pointer is the user's responsibility.
572
+ */
573
+ size_type
574
+ erase(const key_type& __x)
575
+ { return _M_t.erase(__x); }
576
+
577
+ #if __cplusplus >= 201103L
578
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
579
+ // DR 130. Associative erase should return an iterator.
580
+ /**
581
+ * @brief Erases a [first,last) range of elements from a %multiset.
582
+ * @param __first Iterator pointing to the start of the range to be
583
+ * erased.
584
+ * @param __last Iterator pointing to the end of the range to
585
+ * be erased.
586
+ * @return The iterator @a last.
587
+ *
588
+ * This function erases a sequence of elements from a %multiset.
589
+ * Note that this function only erases the elements, and that if
590
+ * the elements themselves are pointers, the pointed-to memory is not
591
+ * touched in any way. Managing the pointer is the user's
592
+ * responsibility.
593
+ */
594
+ _GLIBCXX_ABI_TAG_CXX11
595
+ iterator
596
+ erase(const_iterator __first, const_iterator __last)
597
+ { return _M_t.erase(__first, __last); }
598
+ #else
599
+ /**
600
+ * @brief Erases a [first,last) range of elements from a %multiset.
601
+ * @param first Iterator pointing to the start of the range to be
602
+ * erased.
603
+ * @param last Iterator pointing to the end of the range to be erased.
604
+ *
605
+ * This function erases a sequence of elements from a %multiset.
606
+ * Note that this function only erases the elements, and that if
607
+ * the elements themselves are pointers, the pointed-to memory is not
608
+ * touched in any way. Managing the pointer is the user's
609
+ * responsibility.
610
+ */
611
+ void
612
+ erase(iterator __first, iterator __last)
613
+ { _M_t.erase(__first, __last); }
614
+ #endif
615
+
616
+ /**
617
+ * Erases all elements in a %multiset. Note that this function only
618
+ * erases the elements, and that if the elements themselves are pointers,
619
+ * the pointed-to memory is not touched in any way. Managing the pointer
620
+ * is the user's responsibility.
621
+ */
622
+ void
623
+ clear() _GLIBCXX_NOEXCEPT
624
+ { _M_t.clear(); }
625
+
626
+ // multiset operations:
627
+
628
+ /**
629
+ * @brief Finds the number of elements with given key.
630
+ * @param __x Key of elements to be located.
631
+ * @return Number of elements with specified key.
632
+ */
633
+ size_type
634
+ count(const key_type& __x) const
635
+ { return _M_t.count(__x); }
636
+
637
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
638
+ // 214. set::find() missing const overload
639
+ //@{
640
+ /**
641
+ * @brief Tries to locate an element in a %set.
642
+ * @param __x Element to be located.
643
+ * @return Iterator pointing to sought-after element, or end() if not
644
+ * found.
645
+ *
646
+ * This function takes a key and tries to locate the element with which
647
+ * the key matches. If successful the function returns an iterator
648
+ * pointing to the sought after element. If unsuccessful it returns the
649
+ * past-the-end ( @c end() ) iterator.
650
+ */
651
+ iterator
652
+ find(const key_type& __x)
653
+ { return _M_t.find(__x); }
654
+
655
+ const_iterator
656
+ find(const key_type& __x) const
657
+ { return _M_t.find(__x); }
658
+ //@}
659
+
660
+ //@{
661
+ /**
662
+ * @brief Finds the beginning of a subsequence matching given key.
663
+ * @param __x Key to be located.
664
+ * @return Iterator pointing to first element equal to or greater
665
+ * than key, or end().
666
+ *
667
+ * This function returns the first element of a subsequence of elements
668
+ * that matches the given key. If unsuccessful it returns an iterator
669
+ * pointing to the first element that has a greater value than given key
670
+ * or end() if no such element exists.
671
+ */
672
+ iterator
673
+ lower_bound(const key_type& __x)
674
+ { return _M_t.lower_bound(__x); }
675
+
676
+ const_iterator
677
+ lower_bound(const key_type& __x) const
678
+ { return _M_t.lower_bound(__x); }
679
+ //@}
680
+
681
+ //@{
682
+ /**
683
+ * @brief Finds the end of a subsequence matching given key.
684
+ * @param __x Key to be located.
685
+ * @return Iterator pointing to the first element
686
+ * greater than key, or end().
687
+ */
688
+ iterator
689
+ upper_bound(const key_type& __x)
690
+ { return _M_t.upper_bound(__x); }
691
+
692
+ const_iterator
693
+ upper_bound(const key_type& __x) const
694
+ { return _M_t.upper_bound(__x); }
695
+ //@}
696
+
697
+ //@{
698
+ /**
699
+ * @brief Finds a subsequence matching given key.
700
+ * @param __x Key to be located.
701
+ * @return Pair of iterators that possibly points to the subsequence
702
+ * matching given key.
703
+ *
704
+ * This function is equivalent to
705
+ * @code
706
+ * std::make_pair(c.lower_bound(val),
707
+ * c.upper_bound(val))
708
+ * @endcode
709
+ * (but is faster than making the calls separately).
710
+ *
711
+ * This function probably only makes sense for multisets.
712
+ */
713
+ std::pair<iterator, iterator>
714
+ equal_range(const key_type& __x)
715
+ { return _M_t.equal_range(__x); }
716
+
717
+ std::pair<const_iterator, const_iterator>
718
+ equal_range(const key_type& __x) const
719
+ { return _M_t.equal_range(__x); }
720
+ //@}
721
+
722
+ template<typename _K1, typename _C1, typename _A1>
723
+ friend bool
724
+ operator==(const multiset<_K1, _C1, _A1>&,
725
+ const multiset<_K1, _C1, _A1>&);
726
+
727
+ template<typename _K1, typename _C1, typename _A1>
728
+ friend bool
729
+ operator< (const multiset<_K1, _C1, _A1>&,
730
+ const multiset<_K1, _C1, _A1>&);
731
+ };
732
+
733
+ /**
734
+ * @brief Multiset equality comparison.
735
+ * @param __x A %multiset.
736
+ * @param __y A %multiset of the same type as @a __x.
737
+ * @return True iff the size and elements of the multisets are equal.
738
+ *
739
+ * This is an equivalence relation. It is linear in the size of the
740
+ * multisets.
741
+ * Multisets are considered equivalent if their sizes are equal, and if
742
+ * corresponding elements compare equal.
743
+ */
744
+ template<typename _Key, typename _Compare, typename _Alloc>
745
+ inline bool
746
+ operator==(const multiset<_Key, _Compare, _Alloc>& __x,
747
+ const multiset<_Key, _Compare, _Alloc>& __y)
748
+ { return __x._M_t == __y._M_t; }
749
+
750
+ /**
751
+ * @brief Multiset ordering relation.
752
+ * @param __x A %multiset.
753
+ * @param __y A %multiset of the same type as @a __x.
754
+ * @return True iff @a __x is lexicographically less than @a __y.
755
+ *
756
+ * This is a total ordering relation. It is linear in the size of the
757
+ * maps. The elements must be comparable with @c <.
758
+ *
759
+ * See std::lexicographical_compare() for how the determination is made.
760
+ */
761
+ template<typename _Key, typename _Compare, typename _Alloc>
762
+ inline bool
763
+ operator<(const multiset<_Key, _Compare, _Alloc>& __x,
764
+ const multiset<_Key, _Compare, _Alloc>& __y)
765
+ { return __x._M_t < __y._M_t; }
766
+
767
+ /// Returns !(x == y).
768
+ template<typename _Key, typename _Compare, typename _Alloc>
769
+ inline bool
770
+ operator!=(const multiset<_Key, _Compare, _Alloc>& __x,
771
+ const multiset<_Key, _Compare, _Alloc>& __y)
772
+ { return !(__x == __y); }
773
+
774
+ /// Returns y < x.
775
+ template<typename _Key, typename _Compare, typename _Alloc>
776
+ inline bool
777
+ operator>(const multiset<_Key,_Compare,_Alloc>& __x,
778
+ const multiset<_Key,_Compare,_Alloc>& __y)
779
+ { return __y < __x; }
780
+
781
+ /// Returns !(y < x)
782
+ template<typename _Key, typename _Compare, typename _Alloc>
783
+ inline bool
784
+ operator<=(const multiset<_Key, _Compare, _Alloc>& __x,
785
+ const multiset<_Key, _Compare, _Alloc>& __y)
786
+ { return !(__y < __x); }
787
+
788
+ /// Returns !(x < y)
789
+ template<typename _Key, typename _Compare, typename _Alloc>
790
+ inline bool
791
+ operator>=(const multiset<_Key, _Compare, _Alloc>& __x,
792
+ const multiset<_Key, _Compare, _Alloc>& __y)
793
+ { return !(__x < __y); }
794
+
795
+ /// See std::multiset::swap().
796
+ template<typename _Key, typename _Compare, typename _Alloc>
797
+ inline void
798
+ swap(multiset<_Key, _Compare, _Alloc>& __x,
799
+ multiset<_Key, _Compare, _Alloc>& __y)
800
+ { __x.swap(__y); }
801
+
802
+ _GLIBCXX_END_NAMESPACE_CONTAINER
803
+ } // namespace std
804
+
805
+ #endif /* _STL_MULTISET_H */