libstdc++: multimap.h Source File

libstdc++

multimap.h
Go to the documentation of this file.
1// Debugging multimap implementation -*- C++ -*-
2
3// Copyright (C) 2003-2026 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/** @file debug/multimap.h
26 * This file is a GNU debug extension to the Standard C++ Library.
27 */
28
29#ifndef _GLIBCXX_DEBUG_MULTIMAP_H
30#define _GLIBCXX_DEBUG_MULTIMAP_H 1
31
32#include <debug/safe_sequence.h>
33#include <debug/safe_container.h>
34#include <debug/safe_iterator.h>
35#include <bits/stl_pair.h>
36
37namespace std _GLIBCXX_VISIBILITY(default)
38{
39namespace __debug
40{
41 /// Class std::multimap with safety/checking/debug instrumentation.
42 template<typename _Key, typename _Tp, typename _Compare = std::less<_Key>,
43 typename _Allocator = std::allocator<std::pair<const _Key, _Tp> > >
44 class multimap
45 : public __gnu_debug::_Safe_container<
46 multimap<_Key, _Tp, _Compare, _Allocator>, _Allocator,
47 __gnu_debug::_Safe_node_sequence>,
48 public _GLIBCXX_STD_C::multimap<_Key, _Tp, _Compare, _Allocator>
49 {
50 typedef _GLIBCXX_STD_C::multimap<
51 _Key, _Tp, _Compare, _Allocator> _Base;
52 typedef __gnu_debug::_Safe_container<
53 multimap, _Allocator, __gnu_debug::_Safe_node_sequence> _Safe;
54
55 typedef typename _Base::const_iterator _Base_const_iterator;
56 typedef typename _Base::iterator _Base_iterator;
57 typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal;
58
59 template<typename _ItT, typename _SeqT, typename _CatT>
60 friend class ::__gnu_debug::_Safe_iterator;
61
62 // Reference wrapper for base class. Disambiguates multimap(const _Base&)
63 // from copy constructor by requiring a user-defined conversion.
64 // See PR libstdc++/90102.
65 struct _Base_ref
66 {
67 _Base_ref(const _Base& __r) : _M_ref(__r) { }
68
69 const _Base& _M_ref;
70 };
71
72 public:
73 // types:
74 typedef _Key key_type;
75 typedef _Tp mapped_type;
76 typedef std::pair<const _Key, _Tp> value_type;
77 typedef _Compare key_compare;
78 typedef _Allocator allocator_type;
79 typedef typename _Base::reference reference;
80 typedef typename _Base::const_reference const_reference;
81
82 typedef __gnu_debug::_Safe_iterator<_Base_iterator, multimap>
83 iterator;
84 typedef __gnu_debug::_Safe_iterator<_Base_const_iterator,
85 multimap> const_iterator;
86
87 typedef typename _Base::size_type size_type;
88 typedef typename _Base::difference_type difference_type;
89 typedef typename _Base::pointer pointer;
90 typedef typename _Base::const_pointer const_pointer;
91 typedef std::reverse_iterator<iterator> reverse_iterator;
92 typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
93
94 // 23.3.1.1 construct/copy/destroy:
95
96#if __cplusplus < 201103L
97 multimap() : _Base() { }
98
99 multimap(const multimap& __x)
100 : _Base(__x) { }
101
102 ~multimap() { }
103#else
104 multimap() = default;
105 multimap(const multimap&) = default;
106 multimap(multimap&&) = default;
107
108 multimap(initializer_list<value_type> __l,
109 const _Compare& __c = _Compare(),
110 const allocator_type& __a = allocator_type())
111 : _Base(__l, __c, __a) { }
112
113 explicit
114 multimap(const allocator_type& __a)
115 : _Base(__a) { }
116
117 multimap(const multimap& __m,
118 const __type_identity_t<allocator_type>& __a)
119 : _Base(__m, __a) { }
120
121 multimap(multimap&& __m, const __type_identity_t<allocator_type>& __a)
122 noexcept( noexcept(_Base(std::move(__m), __a)) )
123 : _Safe(std::move(__m), __a),
124 _Base(std::move(__m), __a) { }
125
126 multimap(initializer_list<value_type> __l, const allocator_type& __a)
127 : _Base(__l, __a) { }
128
129 template<typename _InputIterator>
130 multimap(_InputIterator __first, _InputIterator __last,
131 const allocator_type& __a)
132 : _Base(__gnu_debug::__base(
133 __glibcxx_check_valid_constructor_range(__first, __last)),
134 __gnu_debug::__base(__last), __a) { }
135
136#if __glibcxx_containers_ranges // C++ >= 23
137 /**
138 * @brief Construct a multimap from a range.
139 * @since C++23
140 */
141 template<std::__detail::__container_compatible_range<value_type> _Rg>
142 multimap(std::from_range_t __t, _Rg&& __rg,
143 const _Compare& __c,
144 const allocator_type& __a = allocator_type())
145 : _Base(__t, std::forward<_Rg>(__rg), __c, __a)
146 { }
147
148 template<std::__detail::__container_compatible_range<value_type> _Rg>
149 multimap(std::from_range_t __t, _Rg&& __rg,
150 const allocator_type& __a = allocator_type())
151 : _Base(__t, std::forward<_Rg>(__rg), __a)
152 { }
153#endif
154
155 ~multimap() = default;
156#endif
157
158 explicit multimap(const _Compare& __comp,
159 const _Allocator& __a = _Allocator())
160 : _Base(__comp, __a) { }
161
162 template<typename _InputIterator>
163 multimap(_InputIterator __first, _InputIterator __last,
164 const _Compare& __comp = _Compare(),
165 const _Allocator& __a = _Allocator())
166 : _Base(__gnu_debug::__base(
167 __glibcxx_check_valid_constructor_range(__first, __last)),
168 __gnu_debug::__base(__last),
169 __comp, __a) { }
170
171 multimap(_Base_ref __x)
172 : _Base(__x._M_ref) { }
173
174#if __cplusplus >= 201103L
175 multimap&
176 operator=(const multimap&) = default;
177
178 multimap&
179 operator=(multimap&&) = default;
180
181 multimap&
182 operator=(initializer_list<value_type> __l)
183 {
184 _Base::operator=(__l);
185 this->_M_invalidate_all();
186 return *this;
187 }
188#endif
189
190 using _Base::get_allocator;
191
192 // iterators:
193 iterator
194 begin() _GLIBCXX_NOEXCEPT
195 { return iterator(_Base::begin(), this); }
196
197 const_iterator
198 begin() const _GLIBCXX_NOEXCEPT
199 { return const_iterator(_Base::begin(), this); }
200
201 iterator
202 end() _GLIBCXX_NOEXCEPT
203 { return iterator(_Base::end(), this); }
204
205 const_iterator
206 end() const _GLIBCXX_NOEXCEPT
207 { return const_iterator(_Base::end(), this); }
208
209 reverse_iterator
210 rbegin() _GLIBCXX_NOEXCEPT
211 { return reverse_iterator(end()); }
212
213 const_reverse_iterator
214 rbegin() const _GLIBCXX_NOEXCEPT
215 { return const_reverse_iterator(end()); }
216
217 reverse_iterator
218 rend() _GLIBCXX_NOEXCEPT
219 { return reverse_iterator(begin()); }
220
221 const_reverse_iterator
222 rend() const _GLIBCXX_NOEXCEPT
223 { return const_reverse_iterator(begin()); }
224
225#if __cplusplus >= 201103L
226 const_iterator
227 cbegin() const noexcept
228 { return const_iterator(_Base::begin(), this); }
229
230 const_iterator
231 cend() const noexcept
232 { return const_iterator(_Base::end(), this); }
233
234 const_reverse_iterator
235 crbegin() const noexcept
236 { return const_reverse_iterator(end()); }
237
238 const_reverse_iterator
239 crend() const noexcept
240 { return const_reverse_iterator(begin()); }
241#endif
242
243 // capacity:
244 using _Base::empty;
245 using _Base::size;
246 using _Base::max_size;
247
248 // modifiers:
249#if __cplusplus >= 201103L
250 template<typename... _Args>
251 iterator
252 emplace(_Args&&... __args)
253 { return { _Base::emplace(std::forward<_Args>(__args)...), this }; }
254
255 template<typename... _Args>
256 iterator
257 emplace_hint(const_iterator __pos, _Args&&... __args)
258 {
259 __glibcxx_check_insert(__pos);
260 return
261 {
262 _Base::emplace_hint(__pos.base(), std::forward<_Args>(__args)...),
263 this
264 };
265 }
266#endif
267
268 iterator
269 insert(const value_type& __x)
270 { return iterator(_Base::insert(__x), this); }
271
272#if __cplusplus >= 201103L
273 // _GLIBCXX_RESOLVE_LIB_DEFECTS
274 // 2354. Unnecessary copying when inserting into maps with braced-init
275 iterator
276 insert(value_type&& __x)
277 { return { _Base::insert(std::move(__x)), this }; }
278
279 template<typename _Pair, typename = typename
280 std::enable_if<std::is_constructible<value_type,
281 _Pair&&>::value>::type>
282 iterator
283 insert(_Pair&& __x)
284 { return { _Base::insert(std::forward<_Pair>(__x)), this }; }
285#endif
286
287#if __cplusplus >= 201103L
288 void
289 insert(std::initializer_list<value_type> __list)
290 { _Base::insert(__list); }
291#endif
292
293 iterator
294#if __cplusplus >= 201103L
295 insert(const_iterator __position, const value_type& __x)
296#else
297 insert(iterator __position, const value_type& __x)
298#endif
299 {
300 __glibcxx_check_insert(__position);
301 return iterator(_Base::insert(__position.base(), __x), this);
302 }
303
304#if __cplusplus >= 201103L
305 // _GLIBCXX_RESOLVE_LIB_DEFECTS
306 // 2354. Unnecessary copying when inserting into maps with braced-init
307 iterator
308 insert(const_iterator __position, value_type&& __x)
309 {
310 __glibcxx_check_insert(__position);
311 return { _Base::insert(__position.base(), std::move(__x)), this };
312 }
313
314 template<typename _Pair, typename = typename
315 std::enable_if<std::is_constructible<value_type,
316 _Pair&&>::value>::type>
317 iterator
318 insert(const_iterator __position, _Pair&& __x)
319 {
320 __glibcxx_check_insert(__position);
321 return
322 {
323 _Base::insert(__position.base(), std::forward<_Pair>(__x)),
324 this
325 };
326 }
327#endif
328
329 template<typename _InputIterator>
330 void
331 insert(_InputIterator __first, _InputIterator __last)
332 {
333 typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist;
334 __glibcxx_check_valid_range2(__first, __last, __dist);
335
336 if (__dist.second >= __gnu_debug::__dp_sign)
337 _Base::insert(__gnu_debug::__unsafe(__first),
338 __gnu_debug::__unsafe(__last));
339 else
340 _Base::insert(__first, __last);
341 }
342
343#ifdef __glibcxx_node_extract // >= C++17 && HOSTED
344 using node_type = typename _Base::node_type;
345
346 node_type
347 extract(const_iterator __position)
348 {
349 __glibcxx_check_erase(__position);
350 this->_M_invalidate_if(_Equal(__position.base()));
351 return _Base::extract(__position.base());
352 }
353
354 node_type
355 extract(const key_type& __key)
356 {
357 const auto __position = find(__key);
358 if (__position != end())
359 return extract(__position);
360 return {};
361 }
362
363# ifdef __glibcxx_associative_heterogeneous_erasure
364 template <__heterogeneous_tree_key<multimap> _Kt>
365 node_type
366 extract(_Kt&& __key)
367 {
368 const auto __position = find(__key);
369 if (__position != end())
370 return extract(__position);
371 return {};
372 }
373# endif
374
375 iterator
376 insert(node_type&& __nh)
377 { return { _Base::insert(std::move(__nh)), this }; }
378
379 iterator
380 insert(const_iterator __hint, node_type&& __nh)
381 {
382 __glibcxx_check_insert(__hint);
383 return { _Base::insert(__hint.base(), std::move(__nh)), this };
384 }
385
386 using _Base::merge;
387#endif // C++17
388
389#if __cplusplus >= 201103L
390 iterator
391 erase(const_iterator __position)
392 {
393 __glibcxx_check_erase(__position);
394 return { erase(__position.base()), this };
395 }
396
397 _Base_iterator
398 erase(_Base_const_iterator __position)
399 {
400 __glibcxx_check_erase2(__position);
401 this->_M_invalidate_if(_Equal(__position));
402 return _Base::erase(__position);
403 }
404
405 _GLIBCXX_ABI_TAG_CXX11
406 iterator
407 erase(iterator __position)
408 { return erase(const_iterator(__position)); }
409#else
410 void
411 erase(iterator __position)
412 {
413 __glibcxx_check_erase(__position);
414 this->_M_invalidate_if(_Equal(__position.base()));
415 _Base::erase(__position.base());
416 }
417#endif
418
419 size_type
420 erase(const key_type& __x)
421 {
422 std::pair<_Base_iterator, _Base_iterator> __victims =
423 _Base::equal_range(__x);
424 size_type __count = 0;
425 _Base_iterator __victim = __victims.first;
426 while (__victim != __victims.second)
427 {
428 this->_M_invalidate_if(_Equal(__victim));
429 _Base::erase(__victim++);
430 ++__count;
431 }
432 return __count;
433 }
434
435# ifdef __glibcxx_associative_heterogeneous_erasure
436 template <__heterogeneous_tree_key<multimap> _Kt>
437 size_type
438 erase(_Kt&& __x)
439 {
440 auto __victims = _Base::equal_range(__x);
441 size_type __count = 0;
442 for (auto __victim = __victims.first; __victim != __victims.second;)
443 {
444 this->_M_invalidate_if(_Equal(__victim));
445 _Base::erase(__victim++);
446 ++__count;
447 }
448 return __count;
449 }
450# endif
451
452#if __cplusplus >= 201103L
453 iterator
454 erase(const_iterator __first, const_iterator __last)
455 {
456 // _GLIBCXX_RESOLVE_LIB_DEFECTS
457 // 151. can't currently clear() empty container
458 __glibcxx_check_erase_range(__first, __last);
459 for (_Base_const_iterator __victim = __first.base();
460 __victim != __last.base(); ++__victim)
461 {
462 _GLIBCXX_DEBUG_VERIFY(__victim != _Base::cend(),
463 _M_message(__gnu_debug::__msg_valid_range)
464 ._M_iterator(__first, "first")
465 ._M_iterator(__last, "last"));
466 this->_M_invalidate_if(_Equal(__victim));
467 }
468
469 return { _Base::erase(__first.base(), __last.base()), this };
470 }
471#else
472 void
473 erase(iterator __first, iterator __last)
474 {
475 // _GLIBCXX_RESOLVE_LIB_DEFECTS
476 // 151. can't currently clear() empty container
477 __glibcxx_check_erase_range(__first, __last);
478 for (_Base_iterator __victim = __first.base();
479 __victim != __last.base(); ++__victim)
480 {
481 _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(),
482 _M_message(__gnu_debug::__msg_valid_range)
483 ._M_iterator(__first, "first")
484 ._M_iterator(__last, "last"));
485 this->_M_invalidate_if(_Equal(__victim));
486 }
487 _Base::erase(__first.base(), __last.base());
488 }
489#endif
490
491 void
492 swap(multimap& __x)
493 _GLIBCXX_NOEXCEPT_IF( noexcept(declval<_Base&>().swap(__x)) )
494 {
495 _Safe::_M_swap(__x);
496 _Base::swap(__x);
497 }
498
499 void
500 clear() _GLIBCXX_NOEXCEPT
501 {
502 this->_M_invalidate_all();
503 _Base::clear();
504 }
505
506 // observers:
507 using _Base::key_comp;
508 using _Base::value_comp;
509
510 // 23.3.1.3 multimap operations:
511 iterator
512 find(const key_type& __x)
513 { return iterator(_Base::find(__x), this); }
514
515#ifdef __glibcxx_generic_associative_lookup // C++ >= 14
516 template<typename _Kt,
517 typename _Req =
518 typename __has_is_transparent<_Compare, _Kt>::type>
519 iterator
520 find(const _Kt& __x)
521 { return { _Base::find(__x), this }; }
522#endif
523
524 const_iterator
525 find(const key_type& __x) const
526 { return const_iterator(_Base::find(__x), this); }
527
528#ifdef __glibcxx_generic_associative_lookup // C++ >= 14
529 template<typename _Kt,
530 typename _Req =
531 typename __has_is_transparent<_Compare, _Kt>::type>
532 const_iterator
533 find(const _Kt& __x) const
534 { return { _Base::find(__x), this }; }
535#endif
536
537 using _Base::count;
538
539 iterator
540 lower_bound(const key_type& __x)
541 { return iterator(_Base::lower_bound(__x), this); }
542
543#ifdef __glibcxx_generic_associative_lookup // C++ >= 14
544 template<typename _Kt,
545 typename _Req =
546 typename __has_is_transparent<_Compare, _Kt>::type>
547 iterator
548 lower_bound(const _Kt& __x)
549 { return { _Base::lower_bound(__x), this }; }
550#endif
551
552 const_iterator
553 lower_bound(const key_type& __x) const
554 { return const_iterator(_Base::lower_bound(__x), this); }
555
556#ifdef __glibcxx_generic_associative_lookup // C++ >= 14
557 template<typename _Kt,
558 typename _Req =
559 typename __has_is_transparent<_Compare, _Kt>::type>
560 const_iterator
561 lower_bound(const _Kt& __x) const
562 { return { _Base::lower_bound(__x), this }; }
563#endif
564
565 iterator
566 upper_bound(const key_type& __x)
567 { return iterator(_Base::upper_bound(__x), this); }
568
569#ifdef __glibcxx_generic_associative_lookup // C++ >= 14
570 template<typename _Kt,
571 typename _Req =
572 typename __has_is_transparent<_Compare, _Kt>::type>
573 iterator
574 upper_bound(const _Kt& __x)
575 { return { _Base::upper_bound(__x), this }; }
576#endif
577
578 const_iterator
579 upper_bound(const key_type& __x) const
580 { return const_iterator(_Base::upper_bound(__x), this); }
581
582#ifdef __glibcxx_generic_associative_lookup // C++ >= 14
583 template<typename _Kt,
584 typename _Req =
585 typename __has_is_transparent<_Compare, _Kt>::type>
586 const_iterator
587 upper_bound(const _Kt& __x) const
588 { return { _Base::upper_bound(__x), this }; }
589#endif
590
591 std::pair<iterator,iterator>
592 equal_range(const key_type& __x)
593 {
594 std::pair<_Base_iterator, _Base_iterator> __res =
595 _Base::equal_range(__x);
596 return std::make_pair(iterator(__res.first, this),
597 iterator(__res.second, this));
598 }
599
600#ifdef __glibcxx_generic_associative_lookup // C++ >= 14
601 template<typename _Kt,
602 typename _Req =
603 typename __has_is_transparent<_Compare, _Kt>::type>
604 std::pair<iterator, iterator>
605 equal_range(const _Kt& __x)
606 {
607 auto __res = _Base::equal_range(__x);
608 return { { __res.first, this }, { __res.second, this } };
609 }
610#endif
611
612 std::pair<const_iterator,const_iterator>
613 equal_range(const key_type& __x) const
614 {
615 std::pair<_Base_const_iterator, _Base_const_iterator> __res =
616 _Base::equal_range(__x);
617 return std::make_pair(const_iterator(__res.first, this),
618 const_iterator(__res.second, this));
619 }
620
621#ifdef __glibcxx_generic_associative_lookup // C++ >= 14
622 template<typename _Kt,
623 typename _Req =
624 typename __has_is_transparent<_Compare, _Kt>::type>
625 std::pair<const_iterator, const_iterator>
626 equal_range(const _Kt& __x) const
627 {
628 auto __res = _Base::equal_range(__x);
629 return { { __res.first, this }, { __res.second, this } };
630 }
631#endif
632
633 _Base&
634 _M_base() _GLIBCXX_NOEXCEPT { return *this; }
635
636 const _Base&
637 _M_base() const _GLIBCXX_NOEXCEPT { return *this; }
638 };
639
640#if __cpp_deduction_guides >= 201606
641
642 template<typename _InputIterator,
643 typename _Compare = less<__iter_key_t<_InputIterator>>,
644 typename _Allocator = allocator<__iter_to_alloc_t<_InputIterator>>,
645 typename = _RequireInputIter<_InputIterator>,
646 typename = _RequireNotAllocator<_Compare>,
647 typename = _RequireAllocator<_Allocator>>
648 multimap(_InputIterator, _InputIterator,
649 _Compare = _Compare(), _Allocator = _Allocator())
650 -> multimap<__iter_key_t<_InputIterator>, __iter_val_t<_InputIterator>,
651 _Compare, _Allocator>;
652
653 template<typename _Key, typename _Tp, typename _Compare = less<_Key>,
654 typename _Allocator = allocator<pair<const _Key, _Tp>>,
655 typename = _RequireNotAllocator<_Compare>,
656 typename = _RequireAllocator<_Allocator>>
657 multimap(initializer_list<pair<_Key, _Tp>>,
658 _Compare = _Compare(), _Allocator = _Allocator())
659 -> multimap<_Key, _Tp, _Compare, _Allocator>;
660
661 template<typename _InputIterator, typename _Allocator,
662 typename = _RequireInputIter<_InputIterator>,
663 typename = _RequireAllocator<_Allocator>>
664 multimap(_InputIterator, _InputIterator, _Allocator)
665 -> multimap<__iter_key_t<_InputIterator>, __iter_val_t<_InputIterator>,
666 less<__iter_key_t<_InputIterator>>, _Allocator>;
667
668 template<typename _Key, typename _Tp, typename _Allocator,
669 typename = _RequireAllocator<_Allocator>>
670 multimap(initializer_list<pair<_Key, _Tp>>, _Allocator)
671 -> multimap<_Key, _Tp, less<_Key>, _Allocator>;
672
673#if __glibcxx_containers_ranges // C++ >= 23
674 template<ranges::input_range _Rg,
675 __not_allocator_like _Compare = less<__detail::__range_key_type<_Rg>>,
676 __allocator_like _Alloc =
677 std::allocator<__detail::__range_to_alloc_type<_Rg>>>
678 multimap(from_range_t, _Rg&&, _Compare = _Compare(), _Alloc = _Alloc())
679 -> multimap<__detail::__range_key_type<_Rg>,
680 __detail::__range_mapped_type<_Rg>,
681 _Compare, _Alloc>;
682
683 template<ranges::input_range _Rg, __allocator_like _Alloc>
684 multimap(from_range_t, _Rg&&, _Alloc)
685 -> multimap<__detail::__range_key_type<_Rg>,
686 __detail::__range_mapped_type<_Rg>,
687 less<__detail::__range_key_type<_Rg>>,
688 _Alloc>;
689#endif
690#endif
691
692 template<typename _Key, typename _Tp,
693 typename _Compare, typename _Allocator>
694 inline bool
695 operator==(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
696 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
697 { return __lhs._M_base() == __rhs._M_base(); }
698
699#if __cpp_lib_three_way_comparison
700 template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
701 inline __detail::__synth3way_t<pair<const _Key, _Tp>>
702 operator<=>(const multimap<_Key, _Tp, _Compare, _Alloc>& __lhs,
703 const multimap<_Key, _Tp, _Compare, _Alloc>& __rhs)
704 { return __lhs._M_base() <=> __rhs._M_base(); }
705#else
706 template<typename _Key, typename _Tp,
707 typename _Compare, typename _Allocator>
708 inline bool
709 operator!=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
710 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
711 { return __lhs._M_base() != __rhs._M_base(); }
712
713 template<typename _Key, typename _Tp,
714 typename _Compare, typename _Allocator>
715 inline bool
716 operator<(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
717 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
718 { return __lhs._M_base() < __rhs._M_base(); }
719
720 template<typename _Key, typename _Tp,
721 typename _Compare, typename _Allocator>
722 inline bool
723 operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
724 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
725 { return __lhs._M_base() <= __rhs._M_base(); }
726
727 template<typename _Key, typename _Tp,
728 typename _Compare, typename _Allocator>
729 inline bool
730 operator>=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
731 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
732 { return __lhs._M_base() >= __rhs._M_base(); }
733
734 template<typename _Key, typename _Tp,
735 typename _Compare, typename _Allocator>
736 inline bool
737 operator>(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
738 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
739 { return __lhs._M_base() > __rhs._M_base(); }
740#endif // three-way comparison
741
742 template<typename _Key, typename _Tp,
743 typename _Compare, typename _Allocator>
744 inline void
745 swap(multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
746 multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
747 _GLIBCXX_NOEXCEPT_IF(noexcept(__lhs.swap(__rhs)))
748 { __lhs.swap(__rhs); }
749
750} // namespace __debug
751} // namespace std
752
753#endif
stl_pair.h
__glibcxx_check_insert
#define __glibcxx_check_insert(_Position)
Definition macros.h:143
__glibcxx_check_erase_range
#define __glibcxx_check_erase_range(_First, _Last)
Definition macros.h:245
__glibcxx_check_erase
#define __glibcxx_check_erase(_Position)
Definition macros.h:209
safe_container.h
safe_iterator.h
safe_sequence.h
std::chrono::operator<=
constexpr bool operator<=(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
Definition chrono.h:863
std::chrono::operator>=
constexpr bool operator>=(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
Definition chrono.h:877
std::chrono::operator<
constexpr bool operator<(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
Definition chrono.h:830
std::chrono::operator>
constexpr bool operator>(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
Definition chrono.h:870
std::make_pair
constexpr pair< typename __decay_and_strip< _T1 >::__type, typename __decay_and_strip< _T2 >::__type > make_pair(_T1 &&__x, _T2 &&__y)
A convenience wrapper for creating a pair from two objects.
Definition stl_pair.h:1169
std::declval
auto declval() noexcept -> decltype(__declval< _Tp >(0))
Definition type_traits:2718
std::move
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
Definition move.h:138
std::forward
constexpr _Tp && forward(typename std::remove_reference< _Tp >::type &__t) noexcept
Forward an lvalue.
Definition move.h:72
std
ISO C++ entities toplevel namespace is std.
__gnu_debug::__base
constexpr _Iterator __base(_Iterator __it)
Definition helper_functions.h:339
std::__debug
GNU debug code, replaces standard behavior with debug behavior.
std::initializer_list
initializer_list
Definition initializer_list:48
std::enable_if
Define a member typedef type only if a boolean constant is true.
Definition type_traits:137
std::is_constructible
is_constructible
Definition type_traits:1242
std::allocator
The standard allocator, as per C++03 [20.4.1].
Definition allocator.h:134
__gnu_debug::_Safe_iterator
Safe iterator wrapper.
Definition safe_iterator.h:133
__gnu_debug::_Safe_iterator::base
constexpr _Iterator & base() noexcept
Return the underlying iterator.
Definition safe_iterator.h:433
std::less
One of the comparison functors.
Definition stl_function.h:404
std::reverse_iterator
Definition bits/stl_iterator.h:137
std::pair
Struct holding two objects (or references) of arbitrary type.
Definition stl_pair.h:307
std::pair::first
_T1 first
The first member.
Definition stl_pair.h:311
std::pair::second
_T2 second
The second member.
Definition stl_pair.h:312
std::multimap
A standard container made up of (key,value) pairs, which can be retrieved based on a key,...
Definition stl_multimap.h:106
std::__debug::multimap
Class std::multimap with safety/checking/debug instrumentation.
Definition multimap.h:49
__gnu_debug::_Safe_container
Safe class dealing with some allocator dependent operations.
Definition safe_container.h:43
__gnu_debug::_Equal_to
Definition safe_sequence.h:61
__gnu_debug::_Safe_node_sequence
Like _Safe_sequence but with a special _M_invalidate_all implementation not invalidating past-the-end...
Definition safe_sequence.h:147
std::ranges::input_range
A range for which ranges::begin returns an input iterator.
Definition ranges_base.h:599