29#ifndef _GLIBCXX_FLAT_MAP
30#define _GLIBCXX_FLAT_MAP 1
33#pragma GCC system_header
36#define __glibcxx_want_constexpr_flat_map
37#define __glibcxx_want_flat_map
40#ifdef __cpp_lib_flat_map
58namespace std _GLIBCXX_VISIBILITY(default)
60_GLIBCXX_BEGIN_NAMESPACE_VERSION
62 template<
typename _Key,
typename _Tp,
typename _Compare,
63 typename _KeyContainer,
typename _MappedContainer>
66 template<
typename _Key,
typename _Tp,
typename _Compare,
67 typename _KeyContainer,
typename _MappedContainer>
70 template<
typename _Key,
typename _Tp,
typename _Compare,
71 typename _KeyContainer,
typename _MappedContainer,
bool _Multi>
74 static_assert(is_same_v<_Key, typename _KeyContainer::value_type>);
75 static_assert(is_same_v<_Tp, typename _MappedContainer::value_type>);
77 using _Derived = __conditional_t<_Multi,
78 flat_multimap<_Key, _Tp, _Compare,
79 _KeyContainer, _MappedContainer>,
80 flat_map<_Key, _Tp, _Compare,
81 _KeyContainer, _MappedContainer>>;
82 using __sorted_t = __conditional_t<_Multi, sorted_equivalent_t, sorted_unique_t>;
85 template<
bool _Const>
struct _Iterator;
87 using key_type = _Key;
88 using mapped_type = _Tp;
89 using value_type = pair<key_type, mapped_type>;
90 using key_compare = _Compare;
91 using reference = pair<const key_type&, mapped_type&>;
92 using const_reference = pair<const key_type&, const mapped_type&>;
93 using size_type = size_t;
94 using difference_type = ptrdiff_t;
95 using iterator = _Iterator<false>;
96 using const_iterator = _Iterator<true>;
97 using reverse_iterator = std::reverse_iterator<iterator>;
98 using const_reverse_iterator = std::reverse_iterator<const_iterator>;
99 using key_container_type = _KeyContainer;
100 using mapped_container_type = _MappedContainer;
103 using __emplace_result_t = __conditional_t<_Multi, iterator, pair<iterator, bool>>;
108 [[no_unique_address]] key_compare _M_comp;
110 value_compare(key_compare __c) : _M_comp(__c) { }
115 operator()(const_reference __x, const_reference __y)
const
116 {
return _M_comp(__x.first, __y.first); }
118 friend _Flat_map_impl;
123 key_container_type keys;
124 mapped_container_type values;
133 _ClearGuard(containers& __cont)
142 _M_cont->keys.clear();
143 _M_cont->values.clear();
150 { _M_cont =
nullptr; }
155 _M_make_clear_guard()
156 {
return _ClearGuard{this->_M_cont}; }
161 _Flat_map_impl() : _Flat_map_impl(key_compare()) { }
165 _Flat_map_impl(
const key_compare& __comp)
166 : _M_cont(), _M_comp(__comp)
170 _Flat_map_impl(key_container_type __key_cont,
171 mapped_container_type __mapped_cont,
172 const key_compare& __comp = key_compare())
173 : _M_cont(std::move(__key_cont), std::move(__mapped_cont)), _M_comp(__comp)
175 __glibcxx_assert(_M_cont.keys.size() == _M_cont.values.size());
180 _Flat_map_impl(__sorted_t,
181 key_container_type __key_cont,
182 mapped_container_type __mapped_cont,
183 const key_compare& __comp = key_compare())
184 : _M_cont(std::move(__key_cont), std::move(__mapped_cont)), _M_comp(__comp)
186 __glibcxx_assert(_M_cont.keys.size() == _M_cont.values.size());
187 _GLIBCXX_DEBUG_ASSERT(ranges::is_sorted(_M_cont.keys, _M_comp));
190 template<__has_input_iter_cat _InputIterator>
192 _Flat_map_impl(_InputIterator __first, _InputIterator __last,
193 const key_compare& __comp = key_compare())
194 : _M_cont(), _M_comp(__comp)
195 { insert(__first, __last); }
197 template<__has_input_iter_cat _InputIterator>
199 _Flat_map_impl(__sorted_t __s,
200 _InputIterator __first, _InputIterator __last,
201 const key_compare& __comp = key_compare())
202 : _M_cont(), _M_comp(__comp)
203 { insert(__s, __first, __last); }
205 template<__detail::__container_compatible_range<value_type> _Rg>
207 _Flat_map_impl(from_range_t, _Rg&& __rg)
208 : _Flat_map_impl(from_range, std::
forward<_Rg>(__rg), key_compare())
211 template<__detail::__container_compatible_range<value_type> _Rg>
213 _Flat_map_impl(from_range_t, _Rg&& __rg,
const key_compare& __comp)
214 : _Flat_map_impl(__comp)
218 _Flat_map_impl(initializer_list<value_type> __il,
219 const key_compare& __comp = key_compare())
220 : _Flat_map_impl(__il.begin(), __il.end(), __comp)
224 _Flat_map_impl(__sorted_t __s,
225 initializer_list<value_type> __il,
226 const key_compare& __comp = key_compare())
227 : _Flat_map_impl(__s, __il.begin(), __il.end(), __comp)
232 template<__allocator_for<key_container_type, mapped_container_type> _Alloc>
235 _Flat_map_impl(
const _Alloc& __a)
236 : _Flat_map_impl(key_compare(), __a)
239 template<__allocator_for<key_container_type, mapped_container_type> _Alloc>
241 _Flat_map_impl(
const key_compare& __comp,
const _Alloc& __a)
242 : _M_cont(std::make_obj_using_allocator<key_container_type>(__a),
243 std::make_obj_using_allocator<mapped_container_type>(__a)),
247 template<__allocator_for<key_container_type, mapped_container_type> _Alloc>
249 _Flat_map_impl(
const key_container_type& __key_cont,
250 const mapped_container_type& __mapped_cont,
252 : _Flat_map_impl(__key_cont, __mapped_cont, key_compare(), __a)
255 template<__allocator_for<key_container_type, mapped_container_type> _Alloc>
257 _Flat_map_impl(
const key_container_type& __key_cont,
258 const mapped_container_type& __mapped_cont,
259 const key_compare& __comp,
261 : _M_cont(std::make_obj_using_allocator<key_container_type>(__a, __key_cont),
262 std::make_obj_using_allocator<mapped_container_type>(__a, __mapped_cont)),
265 __glibcxx_assert(_M_cont.keys.size() == _M_cont.values.size());
269 template<__allocator_for<key_container_type, mapped_container_type> _Alloc>
271 _Flat_map_impl(__sorted_t __s,
272 const key_container_type& __key_cont,
273 const mapped_container_type& __mapped_cont,
275 : _Flat_map_impl(__s, __key_cont, __mapped_cont, key_compare(), __a)
278 template<__allocator_for<key_container_type, mapped_container_type> _Alloc>
280 _Flat_map_impl(__sorted_t,
281 const key_container_type& __key_cont,
282 const mapped_container_type& __mapped_cont,
283 const key_compare& __comp,
285 : _M_cont(std::make_obj_using_allocator<key_container_type>(__a, __key_cont),
286 std::make_obj_using_allocator<mapped_container_type>(__a, __mapped_cont)),
289 __glibcxx_assert(_M_cont.keys.size() == _M_cont.values.size());
290 _GLIBCXX_DEBUG_ASSERT(ranges::is_sorted(_M_cont.keys, _M_comp));
293 template<__allocator_for<key_container_type, mapped_container_type> _Alloc>
295 _Flat_map_impl(
const _Derived& __x,
const _Alloc& __a)
296 : _M_cont(std::make_obj_using_allocator<key_container_type>(__a, __x._M_cont.keys),
297 std::make_obj_using_allocator<mapped_container_type>(__a, __x._M_cont.values)),
301 template<__allocator_for<key_container_type, mapped_container_type> _Alloc>
303 _Flat_map_impl(_Derived&& __x,
const _Alloc& __a)
304 : _M_cont(std::make_obj_using_allocator<key_container_type>
305 (__a, std::move(__x._M_cont.keys)),
306 std::make_obj_using_allocator<mapped_container_type>
307 (__a, std::move(__x._M_cont.values))),
311 template<__has_input_iter_cat _InputIterator,
312 __allocator_for<key_container_type, mapped_container_type> _Alloc>
314 _Flat_map_impl(_InputIterator __first, _InputIterator __last,
316 : _Flat_map_impl(std::move(__first), std::move(__last), key_compare(), __a)
319 template<__has_input_iter_cat _InputIterator,
320 __allocator_for<key_container_type, mapped_container_type> _Alloc>
322 _Flat_map_impl(_InputIterator __first, _InputIterator __last,
323 const key_compare& __comp,
325 : _Flat_map_impl(__comp, __a)
326 { insert(__first, __last); }
328 template<__has_input_iter_cat _InputIterator,
329 __allocator_for<key_container_type, mapped_container_type> _Alloc>
331 _Flat_map_impl(__sorted_t __s,
332 _InputIterator __first, _InputIterator __last,
334 : _Flat_map_impl(__s, std::move(__first), std::move(__last), key_compare(), __a)
337 template<__has_input_iter_cat _InputIterator,
338 __allocator_for<key_container_type, mapped_container_type> _Alloc>
340 _Flat_map_impl(__sorted_t __s,
341 _InputIterator __first, _InputIterator __last,
342 const key_compare& __comp,
344 : _Flat_map_impl(__comp, __a)
345 { insert(__s, __first, __last); }
347 template<__detail::__container_compatible_range<value_type> _Rg,
348 __allocator_for<key_container_type, mapped_container_type> _Alloc>
350 _Flat_map_impl(from_range_t, _Rg&& __rg,
352 : _Flat_map_impl(from_range, std::
forward<_Rg>(__rg), key_compare(), __a)
355 template<__detail::__container_compatible_range<value_type> _Rg,
356 __allocator_for<key_container_type, mapped_container_type> _Alloc>
358 _Flat_map_impl(from_range_t, _Rg&& __rg,
const key_compare& __comp,
360 : _Flat_map_impl(__comp, __a)
363 template<__allocator_for<key_container_type, mapped_container_type> _Alloc>
365 _Flat_map_impl(initializer_list<value_type> __il,
367 : _Flat_map_impl(__il, key_compare(), __a)
370 template<__allocator_for<key_container_type, mapped_container_type> _Alloc>
372 _Flat_map_impl(initializer_list<value_type> __il,
373 const key_compare& __comp,
375 : _Flat_map_impl(__il.begin(), __il.end(), __comp, __a)
378 template<__allocator_for<key_container_type, mapped_container_type> _Alloc>
380 _Flat_map_impl(__sorted_t __s,
381 initializer_list<value_type> __il,
383 : _Flat_map_impl(__s, __il.begin(), __il.end(), key_compare(), __a)
386 template<__allocator_for<key_container_type, mapped_container_type> _Alloc>
388 _Flat_map_impl(__sorted_t __s,
389 initializer_list<value_type> __il,
390 const key_compare& __comp,
392 : _Flat_map_impl(__s, __il.begin(), __il.end(), __comp, __a)
395 _Flat_map_impl(
const _Flat_map_impl&) =
default;
396 _Flat_map_impl& operator=(
const _Flat_map_impl&) =
default;
399 _Flat_map_impl(_Flat_map_impl&& __other)
400 noexcept(is_nothrow_move_constructible_v<containers>
401 && is_nothrow_move_constructible_v<key_compare>)
405 : _M_cont(std::move(__other._M_cont)), _M_comp(std::move(__other._M_comp))
414 operator=(_Flat_map_impl&& __other)
415 noexcept(is_nothrow_move_assignable_v<containers>
416 && is_nothrow_move_assignable_v<key_compare>)
418 auto __guard = _M_make_clear_guard();
419 auto __guard_other = _ClearGuard{__other._M_cont};
422 __guard._M_disable();
429 operator=(initializer_list<value_type> __il)
433 return static_cast<_Derived&
>(*this);
440 {
return {
this, _M_cont.keys.cbegin()}; }
444 begin() const noexcept
445 {
return {
this, _M_cont.keys.cbegin()}; }
450 {
return {
this, _M_cont.keys.cend()}; }
455 {
return {
this, _M_cont.keys.cend()}; }
460 {
return reverse_iterator(end()); }
463 const_reverse_iterator
464 rbegin() const noexcept
465 {
return const_reverse_iterator(end()); }
470 {
return reverse_iterator(begin()); }
473 const_reverse_iterator
474 rend() const noexcept
475 {
return const_reverse_iterator(begin()); }
479 cbegin() const noexcept
480 {
return {
this, _M_cont.keys.cbegin()}; }
484 cend() const noexcept
485 {
return {
this, _M_cont.keys.cend()}; }
488 const_reverse_iterator
489 crbegin() const noexcept
490 {
return const_reverse_iterator(cend()); }
493 const_reverse_iterator
494 crend() const noexcept
495 {
return const_reverse_iterator(cbegin()); }
501 empty() const noexcept
502 {
return _M_cont.keys.empty(); }
506 size() const noexcept
507 {
return _M_cont.keys.size(); }
511 max_size() const noexcept
518 template<
typename _Key2,
typename... _Args>
521 _M_try_emplace(optional<const_iterator> __hint, _Key2&& __k, _Args&&... __args)
524 typename key_container_type::iterator __key_it;
525 typename mapped_container_type::iterator __value_it;
526 int __r = -1, __s = -1;
527 if (__hint.has_value()
528 && (__hint == cbegin()
529 || (__r = !_M_comp(__k, (*__hint)[-1].first)))
531 || (__s = !_M_comp((*__hint)[0].first, __k))))
533 __key_it = _M_cont.keys.begin() + __hint->_M_index;
534 if constexpr (!_Multi)
535 if (__r == 1 && !_M_comp(__key_it[-1], __k))
536 return {iterator{
this, __key_it - 1},
false};
540 auto __first = _M_cont.keys.begin();
541 auto __last = _M_cont.keys.end();
543 __first += __hint->_M_index;
545 __last = __first + __hint->_M_index;
546 if constexpr (_Multi)
550 __key_it = std::lower_bound(__first, __last, __k, _M_comp);
555 __k, std::not_fn(_M_comp)).base();
558 __key_it = std::lower_bound(__first, __last, __k, _M_comp);
561 if constexpr (!_Multi)
562 if (__key_it != _M_cont.keys.end() && !_M_comp(__k, __key_it[0]))
563 return {iterator{
this, __key_it},
false};
565 auto __guard = _M_make_clear_guard();
567 __value_it = _M_cont.values.begin() + (__key_it - _M_cont.keys.begin());
569 __guard._M_disable();
570 return {iterator{
this, __key_it},
true};
573 template<
typename... _Args>
574 requires is_constructible_v<value_type, _Args...>
577 emplace(_Args&&... __args)
581 if constexpr (_Multi)
587 template<
typename... _Args>
590 emplace_hint(const_iterator __position, _Args&&... __args)
598 insert(
const value_type& __x)
599 {
return emplace(__x); }
603 insert(value_type&& __x)
608 insert(const_iterator __position,
const value_type& __x)
609 {
return emplace_hint(__position, __x); }
613 insert(const_iterator __position, value_type&& __x)
614 {
return emplace_hint(__position,
std::move(__x)); }
616 template<
typename _Arg>
617 requires is_constructible_v<value_type, _Arg>
623 template<
typename _Arg>
624 requires is_constructible_v<value_type, _Arg>
627 insert(const_iterator __position, _Arg&& __x)
631 template<
typename _Iter,
typename _Sent>
634 _M_insert(_Iter __first, _Sent __last,
bool __is_sorted =
false)
636 auto __guard = _M_make_clear_guard();
638 using __ref = iter_reference_t<_Iter>;
639 for (; __first != __last; ++__first)
640 if constexpr (__pair_like<__ref>)
642 __ref __value = *__first;
648 value_type __value = *__first;
649 _M_cont.keys.emplace_back(
std::move(__value.first));
650 _M_cont.values.emplace_back(
std::move(__value.second));
652 auto __zv = views::zip(_M_cont.keys, _M_cont.values);
654 _GLIBCXX_DEBUG_ASSERT(ranges::is_sorted(__zv.begin() + __n, __zv.end(),
657 ranges::sort(__zv.begin() + __n, __zv.end(), value_comp());
658 ranges::inplace_merge(__zv.begin(), __zv.begin() + __n, __zv.end(),
660 if constexpr (!_Multi)
662 __guard._M_disable();
666 template<__has_input_iter_cat _InputIterator>
669 insert(_InputIterator __first, _InputIterator __last)
672 template<__has_input_iter_cat _InputIterator>
675 insert(__sorted_t, _InputIterator __first, _InputIterator __last)
678 template<__detail::__container_compatible_range<value_type> _Rg>
681 insert_range(_Rg&& __rg)
682 { _M_insert(ranges::begin(__rg), ranges::end(__rg)); }
684 template<__detail::__container_compatible_range<value_type> _Rg>
687 insert_range(__sorted_t, _Rg&& __rg)
688 { _M_insert(ranges::begin(__rg), ranges::end(__rg),
true); }
692 insert(initializer_list<value_type> __il)
693 { insert(__il.begin(), __il.end()); }
697 insert(__sorted_t __s, initializer_list<value_type> __il)
698 { insert(__s, __il.begin(), __il.end()); }
704 auto __guard = _M_make_clear_guard();
710 replace(key_container_type&& __key_cont, mapped_container_type&& __mapped_cont)
712 __glibcxx_assert(__key_cont.size() == __mapped_cont.size());
713 _GLIBCXX_DEBUG_ASSERT(ranges::is_sorted(__key_cont, _M_comp));
714 auto __guard = _M_make_clear_guard();
716 _M_cont.values =
std::move(__mapped_cont);
717 __guard._M_disable();
724 erase(iterator __position)
725 {
return erase(
static_cast<const_iterator
>(__position)); }
729 erase(const_iterator __position)
731 auto __guard = _M_make_clear_guard();
732 auto __idx = __position._M_index;
733 auto __it = _M_cont.keys.erase(_M_cont.keys.begin() + __idx);
734 _M_cont.values.erase(_M_cont.values.begin() + __idx);
735 __guard._M_disable();
736 return iterator{
this, __it};
741 erase(
const key_type& __x)
742 {
return erase<const key_type&>(__x); }
744 template<
typename _Key2>
745 requires same_as<remove_cvref_t<_Key2>, _Key>
746 || (__transparent_comparator<_Compare>
747 && !is_convertible_v<_Key2, iterator>
748 && !is_convertible_v<_Key2, const_iterator>)
754 auto __n = __last - __first;
755 erase(__first, __last);
761 erase(const_iterator __first, const_iterator __last)
763 auto __guard = _M_make_clear_guard();
764 auto __it = _M_cont.keys.erase(_M_cont.keys.begin() + __first._M_index,
765 _M_cont.keys.begin() + __last._M_index);
766 _M_cont.values.erase(_M_cont.values.begin() + __first._M_index,
767 _M_cont.values.begin() + __last._M_index);
768 __guard._M_disable();
769 return iterator{
this, __it};
775 noexcept(is_nothrow_swappable_v<key_container_type>
776 && is_nothrow_swappable_v<mapped_container_type>
777 && is_nothrow_swappable_v<key_compare>)
779 auto __guard = _M_make_clear_guard();
780 auto __guard_y = _ClearGuard{__y._M_cont};
781 ranges::swap(_M_cont.keys, __y._M_cont.keys);
782 ranges::swap(_M_cont.values, __y._M_cont.values);
783 ranges::swap(_M_comp, __y._M_comp);
784 __guard._M_disable();
785 __guard_y._M_disable();
792 _M_cont.keys.clear();
793 _M_cont.values.clear();
807 {
return value_compare(_M_comp); }
811 const key_container_type&
812 keys() const noexcept
813 {
return _M_cont.keys; }
817 const mapped_container_type&
818 values() const noexcept
819 {
return _M_cont.values; }
825 find(
const key_type& __x)
826 {
return find<key_type>(__x); }
831 find(
const key_type& __x)
const
832 {
return find<key_type>(__x); }
834 template<
typename _Key2>
835 requires same_as<_Key2, _Key> || __transparent_comparator<_Compare>
839 find(
const _Key2& __x)
841 auto __it = lower_bound(__x);
842 if (__it != end() && !_M_comp(__x, __it->first))
848 template<
typename _Key2>
849 requires same_as<_Key2, _Key> || __transparent_comparator<_Compare>
853 find(
const _Key2& __x)
const
855 auto __it = lower_bound(__x);
856 if (__it != cend() && !_M_comp(__x, __it->first))
865 count(
const key_type& __x)
const
866 {
return count<key_type>(__x); }
868 template<
typename _Key2>
869 requires same_as<_Key2, _Key> || __transparent_comparator<_Compare>
873 count(
const _Key2& __x)
const
875 if constexpr (!_Multi)
876 return contains<_Key2>(__x);
879 auto [__first, __last] = equal_range(__x);
880 return __last - __first;
887 contains(
const key_type& __x)
const
888 {
return contains<key_type>(__x); }
890 template<
typename _Key2>
891 requires same_as<_Key2, _Key> || __transparent_comparator<_Compare>
895 contains(
const _Key2& __x)
const
896 {
return find(__x) != cend(); }
901 lower_bound(
const key_type& __x)
902 {
return lower_bound<key_type>(__x); }
907 lower_bound(
const key_type& __x)
const
908 {
return lower_bound<key_type>(__x); }
910 template<
typename _Key2>
911 requires same_as<_Key2, _Key> || __transparent_comparator<_Compare>
915 lower_bound(
const _Key2& __x)
917 auto __it = std::lower_bound(_M_cont.keys.begin(), _M_cont.keys.end(),
922 template<
typename _Key2>
923 requires same_as<_Key2, _Key> || __transparent_comparator<_Compare>
927 lower_bound(
const _Key2& __x)
const
929 auto __it = std::lower_bound(_M_cont.keys.begin(), _M_cont.keys.end(),
937 upper_bound(
const key_type& __x)
938 {
return upper_bound<key_type>(__x); }
943 upper_bound(
const key_type& __x)
const
944 {
return upper_bound<key_type>(__x); }
946 template<
typename _Key2>
947 requires same_as<_Key2, _Key> || __transparent_comparator<_Compare>
951 upper_bound(
const _Key2& __x)
953 auto __it = std::upper_bound(_M_cont.keys.begin(), _M_cont.keys.end(),
958 template<
typename _Key2>
959 requires same_as<_Key2, _Key> || __transparent_comparator<_Compare>
963 upper_bound(
const _Key2& __x)
const
965 auto __it = std::upper_bound(_M_cont.keys.begin(), _M_cont.keys.end(),
972 pair<iterator, iterator>
973 equal_range(
const key_type& __x)
974 {
return equal_range<key_type>(__x); }
978 pair<const_iterator, const_iterator>
979 equal_range(
const key_type& __x)
const
980 {
return equal_range<key_type>(__x); }
982 template<
typename _Key2>
983 requires same_as<_Key2, _Key> || __transparent_comparator<_Compare>
986 pair<iterator, iterator>
987 equal_range(
const _Key2& __x)
989 auto [__first, __last] = std::equal_range(_M_cont.keys.begin(),
992 return {{
this, __first}, {
this, __last}};
995 template<
typename _Key2>
996 requires same_as<_Key2, _Key> || __transparent_comparator<_Compare>
999 pair<const_iterator, const_iterator>
1000 equal_range(
const _Key2& __x)
const
1002 auto [__first, __last] = std::equal_range(_M_cont.keys.begin(),
1005 return {{
this, __first}, {
this, __last}};
1009 friend _GLIBCXX26_CONSTEXPR
bool
1010 operator==(
const _Derived& __x,
const _Derived& __y)
1012 return __x._M_cont.keys == __y._M_cont.keys
1013 && __x._M_cont.values == __y._M_cont.values;
1016 template<
typename _Up = value_type>
1018 friend _GLIBCXX26_CONSTEXPR __detail::__synth3way_t<_Up>
1019 operator<=>(
const _Derived& __x,
const _Derived& __y)
1022 __y.begin(), __y.end(),
1023 __detail::__synth3way);
1026 friend _GLIBCXX26_CONSTEXPR
void
1027 swap(_Derived& __x, _Derived& __y)
noexcept(
noexcept(__x.swap(__y)))
1028 {
return __x.swap(__y); }
1030 template<
typename _Predicate>
1031 _GLIBCXX26_CONSTEXPR
1033 _M_erase_if(_Predicate __pred)
1035 auto __guard = _M_make_clear_guard();
1036 auto __zv = views::zip(_M_cont.keys, _M_cont.values);
1037 auto __sr = ranges::remove_if(__zv, __pred,
1038 [](
const auto& __e) {
1039 return const_reference(__e);
1041 auto __erased = __sr.size();
1042 erase(end() - __erased, end());
1043 __guard._M_disable();
1049 [[no_unique_address]] _Compare _M_comp;
1051 _GLIBCXX26_CONSTEXPR
1055 auto __zv = views::zip(_M_cont.keys, _M_cont.values);
1056 ranges::sort(__zv, value_comp());
1057 if constexpr (!_Multi)
1061 _GLIBCXX26_CONSTEXPR
1063 _M_unique()
requires (!_Multi)
1067 _GLIBCXX26_CONSTEXPR
1068 __key_equiv(key_compare __c) : _M_comp(__c) { }
1070 _GLIBCXX26_CONSTEXPR
1072 operator()(const_reference __x, const_reference __y)
const
1073 {
return !_M_comp(__x.first, __y.first) && !_M_comp(__y.first, __x.first); }
1075 [[no_unique_address]] key_compare _M_comp;
1078 auto __zv = views::zip(_M_cont.keys, _M_cont.values);
1079 auto __it = ranges::unique(__zv, __key_equiv(_M_comp)).begin();
1080 auto __n = __it - __zv.begin();
1081 _M_cont.keys.erase(_M_cont.keys.begin() + __n, _M_cont.keys.end());
1082 _M_cont.values.erase(_M_cont.values.begin() + __n, _M_cont.values.end());
1086 template<
typename _Key,
typename _Tp,
typename _Compare,
1087 typename _KeyContainer,
typename _MappedContainer,
bool _Multi>
1088 template<
bool _Const>
1089 class _Flat_map_impl<_Key, _Tp, _Compare, _KeyContainer, _MappedContainer, _Multi>::_Iterator
1091 using __size_type =
typename _Flat_map_impl::size_type;
1094 using iterator_category = input_iterator_tag;
1095 using iterator_concept = random_access_iterator_tag;
1096 using value_type = pair<key_type, mapped_type>;
1097 using reference =
pair<
const key_type&,
1098 ranges::__maybe_const_t<_Const, mapped_type>&>;
1099 using difference_type = ptrdiff_t;
1101 _GLIBCXX26_CONSTEXPR
1102 _Iterator() =
default;
1104 _GLIBCXX26_CONSTEXPR
1105 _Iterator(_Iterator<!_Const> __it)
requires _Const
1106 : _M_cont(__it._M_cont), _M_index(__it._M_index)
1109 _GLIBCXX26_CONSTEXPR
1113 __glibcxx_assert(_M_index < _M_cont->keys.size());
1114 return {_M_cont->keys[_M_index], _M_cont->values[_M_index]};
1121 _GLIBCXX26_CONSTEXPR
1123 operator->() const noexcept
1127 _GLIBCXX26_CONSTEXPR
1132 _GLIBCXX26_CONSTEXPR
1134 operator[](difference_type __n)
const noexcept
1135 {
return *(*
this + __n); }
1137 _GLIBCXX26_CONSTEXPR
1139 operator++() noexcept
1145 _GLIBCXX26_CONSTEXPR
1147 operator--() noexcept
1153 _GLIBCXX26_CONSTEXPR
1155 operator++(
int)
noexcept
1162 _GLIBCXX26_CONSTEXPR
1164 operator--(
int)
noexcept
1171 _GLIBCXX26_CONSTEXPR
1173 operator+=(difference_type __n)
noexcept
1179 _GLIBCXX26_CONSTEXPR
1181 operator-=(difference_type __n)
noexcept
1188 friend _Flat_map_impl;
1189 friend _Iterator<!_Const>;
1191 _GLIBCXX26_CONSTEXPR
1192 _Iterator(_Flat_map_impl* __fm,
typename key_container_type::const_iterator __it)
1194 : _M_cont(std::
__addressof(__fm->_M_cont)), _M_index(__it - __fm->keys().cbegin())
1197 _GLIBCXX26_CONSTEXPR
1198 _Iterator(
const _Flat_map_impl* __fm,
typename key_container_type::const_iterator __it)
1200 : _M_cont(
std::__addressof(__fm->_M_cont)), _M_index(__it - __fm->keys().cbegin())
1203 friend _GLIBCXX26_CONSTEXPR _Iterator
1204 operator+(_Iterator __it, difference_type __n)
noexcept
1210 friend _GLIBCXX26_CONSTEXPR _Iterator
1211 operator+(difference_type __n, _Iterator __it)
noexcept
1217 friend _GLIBCXX26_CONSTEXPR _Iterator
1218 operator-(_Iterator __it, difference_type __n)
noexcept
1224 friend _GLIBCXX26_CONSTEXPR difference_type
1225 operator-(
const _Iterator& __x,
const _Iterator& __y)
noexcept
1227 __glibcxx_assert(__x._M_cont == __y._M_cont);
1228 return __x._M_index - __y._M_index;
1231 friend _GLIBCXX26_CONSTEXPR
bool
1232 operator==(
const _Iterator& __x,
const _Iterator& __y)
noexcept
1234 __glibcxx_assert(__x._M_cont == __y._M_cont);
1235 __glibcxx_assert((__x._M_index ==
size_t(-1)) == (__y._M_index ==
size_t(-1)));
1236 return __x._M_index == __y._M_index;
1239 friend _GLIBCXX26_CONSTEXPR strong_ordering
1240 operator<=>(
const _Iterator& __x,
const _Iterator& __y)
1242 __glibcxx_assert(__x._M_cont == __y._M_cont);
1243 __glibcxx_assert((__x._M_index ==
size_t(-1)) == (__y._M_index ==
size_t(-1)));
1244 return __x._M_index <=> __y._M_index;
1247 ranges::__maybe_const_t<_Const, containers>* _M_cont =
nullptr;
1248 __size_type _M_index = -1;
1255 template<
typename _Key,
typename _Tp,
typename _Compare = less<_Key>,
1256 typename _KeyContainer = vector<_Key>,
1257 typename _MappedContainer = vector<_Tp>>
1259 :
private _Flat_map_impl<_Key, _Tp, _Compare, _KeyContainer, _MappedContainer, false>
1261 using _Impl = _Flat_map_impl<_Key, _Tp, _Compare, _KeyContainer, _MappedContainer, false>;
1266 using typename _Impl::key_type;
1267 using typename _Impl::mapped_type;
1268 using typename _Impl::value_type;
1269 using typename _Impl::key_compare;
1270 using typename _Impl::reference;
1271 using typename _Impl::const_reference;
1272 using typename _Impl::size_type;
1273 using typename _Impl::difference_type;
1274 using typename _Impl::iterator;
1275 using typename _Impl::const_iterator;
1276 using typename _Impl::reverse_iterator;
1277 using typename _Impl::const_reverse_iterator;
1278 using typename _Impl::key_container_type;
1279 using typename _Impl::mapped_container_type;
1280 using typename _Impl::value_compare;
1281 using typename _Impl::containers;
1289 using _Impl::operator=;
1294 using _Impl::rbegin;
1297 using _Impl::cbegin;
1299 using _Impl::crbegin;
1305 using _Impl::max_size;
1308 _GLIBCXX26_CONSTEXPR
1310 operator[](
const key_type& __x)
1311 {
return try_emplace(__x).first->second; }
1313 _GLIBCXX26_CONSTEXPR
1315 operator[](key_type&& __x)
1316 {
return try_emplace(
std::move(__x)).first->second; }
1318 template<
typename _Key2>
1319 requires __transparent_comparator<_Compare>
1320 _GLIBCXX26_CONSTEXPR
1322 operator[](_Key2&& __x)
1325 _GLIBCXX26_CONSTEXPR
1327 at(
const key_type& __x)
1328 {
return at<key_type>(__x); }
1330 _GLIBCXX26_CONSTEXPR
1332 at(
const key_type& __x)
const
1333 {
return at<key_type>(__x); }
1335 template<
typename _Key2>
1336 requires same_as<_Key2, _Key> || __transparent_comparator<_Compare>
1337 _GLIBCXX26_CONSTEXPR
1339 at(
const _Key2& __x)
1341 auto __it = this->find(__x);
1342 if (__it == this->end())
1343 __throw_out_of_range(
"flat_map::at");
1344 return __it->second;
1347 template<
typename _Key2>
1348 requires same_as<_Key2, _Key> || __transparent_comparator<_Compare>
1349 _GLIBCXX26_CONSTEXPR
1351 at(
const _Key2& __x)
const
1353 auto __it = this->find(__x);
1354 if (__it == this->end())
1355 __throw_out_of_range(
"flat_map::at");
1356 return __it->second;
1360 using _Impl::emplace;
1361 using _Impl::emplace_hint;
1362 using _Impl::insert;
1363 using _Impl::insert_range;
1364 using _Impl::extract;
1365 using _Impl::replace;
1370 template<
typename... _Args>
1371 requires is_constructible_v<mapped_type, _Args...>
1372 _GLIBCXX26_CONSTEXPR
1373 pair<iterator, bool>
1374 try_emplace(
const key_type& __k, _Args&&... __args)
1377 template<
typename... _Args>
1378 requires is_constructible_v<mapped_type, _Args...>
1379 _GLIBCXX26_CONSTEXPR
1380 pair<iterator, bool>
1381 try_emplace(key_type&& __k, _Args&&... __args)
1383 return _Impl::_M_try_emplace(nullopt,
std::move(__k),
1387 template<
typename _Key2,
typename... _Args>
1388 requires __transparent_comparator<_Compare>
1389 && is_constructible_v<key_type, _Key2>
1390 && is_constructible_v<mapped_type, _Args...>
1391 && (!is_convertible_v<_Key2&&, const_iterator>)
1392 && (!is_convertible_v<_Key2&&, iterator>)
1393 _GLIBCXX26_CONSTEXPR
1394 pair<iterator, bool>
1395 try_emplace(_Key2&& __k, _Args&&... __args)
1401 template<
typename... _Args>
1402 requires is_constructible_v<mapped_type, _Args...>
1403 _GLIBCXX26_CONSTEXPR
1405 try_emplace(const_iterator __hint,
const key_type& __k, _Args&&... __args)
1408 template<
typename... _Args>
1409 requires is_constructible_v<mapped_type, _Args...>
1410 _GLIBCXX26_CONSTEXPR
1412 try_emplace(const_iterator __hint, key_type&& __k, _Args&&... __args)
1414 return _Impl::_M_try_emplace(__hint,
std::move(__k),
1418 template<
typename _Key2,
typename... _Args>
1419 requires __transparent_comparator<_Compare>
1420 && is_constructible_v<key_type, _Key2>
1421 && is_constructible_v<mapped_type, _Args...>
1422 _GLIBCXX26_CONSTEXPR
1424 try_emplace(const_iterator __hint, _Key2&& __k, _Args&&... __args)
1430 template<
typename _Mapped>
1431 requires is_assignable_v<mapped_type&, _Mapped>
1432 && is_constructible_v<mapped_type, _Mapped>
1433 _GLIBCXX26_CONSTEXPR
1434 pair<iterator, bool>
1435 insert_or_assign(
const key_type& __k, _Mapped&& __obj)
1438 template<
typename _Mapped>
1439 requires is_assignable_v<mapped_type&, _Mapped>
1440 && is_constructible_v<mapped_type, _Mapped>
1441 _GLIBCXX26_CONSTEXPR
1442 pair<iterator, bool>
1443 insert_or_assign(key_type&& __k, _Mapped&& __obj)
1445 return insert_or_assign<key_type, _Mapped>(
std::move(__k),
1449 template<
typename _Key2,
typename _Mapped>
1450 requires (same_as<remove_cvref_t<_Key2>, _Key> || __transparent_comparator<_Compare>)
1451 && is_constructible_v<key_type, _Key2>
1452 && is_assignable_v<mapped_type&, _Mapped>
1453 && is_constructible_v<mapped_type, _Mapped>
1454 _GLIBCXX26_CONSTEXPR
1455 pair<iterator, bool>
1456 insert_or_assign(_Key2&& __k, _Mapped&& __obj)
1465 template<
typename _Mapped>
1466 requires is_assignable_v<mapped_type&, _Mapped>
1467 && is_constructible_v<mapped_type, _Mapped>
1468 _GLIBCXX26_CONSTEXPR
1470 insert_or_assign(const_iterator __hint,
const key_type& __k, _Mapped&& __obj)
1472 return insert_or_assign<const key_type&, _Mapped>(__hint, __k,
1476 template<
typename _Mapped>
1477 requires is_assignable_v<mapped_type&, _Mapped>
1478 && is_constructible_v<mapped_type, _Mapped>
1479 _GLIBCXX26_CONSTEXPR
1481 insert_or_assign(const_iterator __hint, key_type&& __k, _Mapped&& __obj)
1483 return insert_or_assign<key_type, _Mapped>(__hint,
std::move(__k),
1487 template<
typename _Key2,
typename _Mapped>
1488 requires (same_as<remove_cvref_t<_Key2>, _Key> || __transparent_comparator<_Compare>)
1489 && is_constructible_v<key_type, _Key2>
1490 && is_assignable_v<mapped_type&, _Mapped>
1491 && is_constructible_v<mapped_type, _Mapped>
1492 _GLIBCXX26_CONSTEXPR
1494 insert_or_assign(const_iterator __hint, _Key2&& __k, _Mapped&& __obj)
1504 using _Impl::key_comp;
1505 using _Impl::value_comp;
1507 using _Impl::values;
1512 using _Impl::contains;
1513 using _Impl::lower_bound;
1514 using _Impl::upper_bound;
1515 using _Impl::equal_range;
1517 using _Impl::_M_erase_if;
1520 template<
typename _KeyContainer,
typename _MappedContainer,
1522 flat_map(_KeyContainer, _MappedContainer, _Compare = _Compare())
1523 -> flat_map<
typename _KeyContainer::value_type,
typename _MappedContainer::value_type,
1524 _Compare, _KeyContainer, _MappedContainer>;
1526 template<
typename _KeyContainer,
typename _MappedContainer,
1527 __allocator_for<_KeyContainer, _MappedContainer> _Alloc>
1528 flat_map(_KeyContainer, _MappedContainer, _Alloc)
1529 -> flat_map<
typename _KeyContainer::value_type,
typename _MappedContainer::value_type,
1532 template<
typename _KeyContainer,
typename _MappedContainer, __not_allocator_like _Compare,
1533 __allocator_for<_KeyContainer, _MappedContainer> _Alloc>
1534 flat_map(_KeyContainer, _MappedContainer, _Compare, _Alloc)
1535 -> flat_map<
typename _KeyContainer::value_type,
typename _MappedContainer::value_type,
1536 _Compare, _KeyContainer, _MappedContainer>;
1538 template<
typename _KeyContainer,
typename _MappedContainer,
1540 flat_map(sorted_unique_t, _KeyContainer, _MappedContainer, _Compare = _Compare())
1541 -> flat_map<
typename _KeyContainer::value_type,
typename _MappedContainer::value_type,
1542 _Compare, _KeyContainer, _MappedContainer>;
1544 template<
typename _KeyContainer,
typename _MappedContainer,
1545 __allocator_for<_KeyContainer, _MappedContainer> _Alloc>
1546 flat_map(sorted_unique_t, _KeyContainer, _MappedContainer, _Alloc)
1547 -> flat_map<
typename _KeyContainer::value_type,
typename _MappedContainer::value_type,
1550 template<
typename _KeyContainer,
typename _MappedContainer, __not_allocator_like _Compare,
1551 __allocator_for<_KeyContainer, _MappedContainer> _Alloc>
1552 flat_map(sorted_unique_t, _KeyContainer, _MappedContainer, _Compare, _Alloc)
1553 -> flat_map<
typename _KeyContainer::value_type,
typename _MappedContainer::value_type,
1554 _Compare, _KeyContainer, _MappedContainer>;
1556 template<__has_input_iter_cat _InputIterator,
1558 flat_map(_InputIterator, _InputIterator, _Compare = _Compare())
1559 -> flat_map<__iter_key_t<_InputIterator>, __iter_val_t<_InputIterator>, _Compare>;
1561 template<__has_input_iter_cat _InputIterator,
1563 flat_map(sorted_unique_t, _InputIterator, _InputIterator, _Compare = _Compare())
1564 -> flat_map<__iter_key_t<_InputIterator>, __iter_val_t<_InputIterator>, _Compare>;
1569 flat_map(from_range_t, _Rg&&, _Compare = _Compare(), _Alloc = _Alloc())
1570 -> flat_map<__detail::__range_key_type<_Rg>, __detail::__range_mapped_type<_Rg>,
1573 __alloc_rebind<_Alloc, __detail::__range_key_type<_Rg>>>,
1575 __alloc_rebind<_Alloc, __detail::__range_mapped_type<_Rg>>>>;
1577 template<ranges::input_range _Rg, __allocator_like _Alloc>
1578 flat_map(from_range_t, _Rg&&, _Alloc)
1579 -> flat_map<__detail::__range_key_type<_Rg>, __detail::__range_mapped_type<_Rg>,
1582 __alloc_rebind<_Alloc, __detail::__range_key_type<_Rg>>>,
1584 __alloc_rebind<_Alloc, __detail::__range_mapped_type<_Rg>>>>;
1586 template<
typename _Key,
typename _Tp, __not_allocator_like _Compare = less<_Key>>
1588 -> flat_map<_Key, _Tp, _Compare>;
1590 template<
typename _Key,
typename _Tp, __not_allocator_like _Compare = less<_Key>>
1592 -> flat_map<_Key, _Tp, _Compare>;
1594 template<
typename _Key,
typename _Tp,
typename _Compare,
1595 typename _KeyContainer,
typename _MappedContainer,
typename _Alloc>
1596 struct uses_allocator<flat_map<_Key, _Tp, _Compare, _KeyContainer, _MappedContainer>, _Alloc>
1597 : bool_constant<uses_allocator_v<_KeyContainer, _Alloc>
1598 && uses_allocator_v<_MappedContainer, _Alloc>>
1601 template<
typename _Key,
typename _Tp,
typename _Compare,
1602 typename _KeyContainer,
typename _MappedContainer,
typename _Predicate>
1603 _GLIBCXX26_CONSTEXPR
1604 typename flat_map<_Key, _Tp, _Compare, _KeyContainer, _MappedContainer>::size_type
1605 erase_if(flat_map<_Key, _Tp, _Compare, _KeyContainer, _MappedContainer>& __c,
1607 {
return __c._M_erase_if(
std::move(__pred)); }
1613 template<
typename _Key,
typename _Tp,
typename _Compare = less<_Key>,
1614 typename _KeyContainer = vector<_Key>,
1615 typename _MappedContainer = vector<_Tp>>
1617 :
private _Flat_map_impl<_Key, _Tp, _Compare, _KeyContainer, _MappedContainer, true>
1619 using _Impl = _Flat_map_impl<_Key, _Tp, _Compare, _KeyContainer, _MappedContainer, true>;
1624 using typename _Impl::key_type;
1625 using typename _Impl::mapped_type;
1626 using typename _Impl::value_type;
1627 using typename _Impl::key_compare;
1628 using typename _Impl::reference;
1629 using typename _Impl::const_reference;
1630 using typename _Impl::size_type;
1631 using typename _Impl::difference_type;
1632 using typename _Impl::iterator;
1633 using typename _Impl::const_iterator;
1634 using typename _Impl::reverse_iterator;
1635 using typename _Impl::const_reverse_iterator;
1636 using typename _Impl::key_container_type;
1637 using typename _Impl::mapped_container_type;
1638 using typename _Impl::value_compare;
1639 using typename _Impl::containers;
1647 using _Impl::operator=;
1652 using _Impl::rbegin;
1655 using _Impl::cbegin;
1657 using _Impl::crbegin;
1663 using _Impl::max_size;
1666 using _Impl::emplace;
1667 using _Impl::emplace_hint;
1668 using _Impl::insert;
1669 using _Impl::insert_range;
1670 using _Impl::extract;
1671 using _Impl::replace;
1677 using _Impl::key_comp;
1678 using _Impl::value_comp;
1680 using _Impl::values;
1685 using _Impl::contains;
1686 using _Impl::lower_bound;
1687 using _Impl::upper_bound;
1688 using _Impl::equal_range;
1690 using _Impl::_M_erase_if;
1693 template<
typename _KeyContainer,
typename _MappedContainer,
1695 flat_multimap(_KeyContainer, _MappedContainer, _Compare = _Compare())
1696 -> flat_multimap<
typename _KeyContainer::value_type,
typename _MappedContainer::value_type,
1697 _Compare, _KeyContainer, _MappedContainer>;
1699 template<
typename _KeyContainer,
typename _MappedContainer,
1700 __allocator_for<_KeyContainer, _MappedContainer> _Alloc>
1701 flat_multimap(_KeyContainer, _MappedContainer, _Alloc)
1702 -> flat_multimap<
typename _KeyContainer::value_type,
typename _MappedContainer::value_type,
1705 template<
typename _KeyContainer,
typename _MappedContainer, __not_allocator_like _Compare,
1706 __allocator_for<_KeyContainer, _MappedContainer> _Alloc>
1707 flat_multimap(_KeyContainer, _MappedContainer, _Compare, _Alloc)
1708 -> flat_multimap<
typename _KeyContainer::value_type,
typename _MappedContainer::value_type,
1709 _Compare, _KeyContainer, _MappedContainer>;
1711 template<
typename _KeyContainer,
typename _MappedContainer,
1713 flat_multimap(sorted_equivalent_t, _KeyContainer, _MappedContainer, _Compare = _Compare())
1714 -> flat_multimap<
typename _KeyContainer::value_type,
typename _MappedContainer::value_type,
1715 _Compare, _KeyContainer, _MappedContainer>;
1717 template<
typename _KeyContainer,
typename _MappedContainer,
1718 __allocator_for<_KeyContainer, _MappedContainer> _Alloc>
1719 flat_multimap(sorted_equivalent_t, _KeyContainer, _MappedContainer, _Alloc)
1720 -> flat_multimap<
typename _KeyContainer::value_type,
typename _MappedContainer::value_type,
1723 template<
typename _KeyContainer,
typename _MappedContainer, __not_allocator_like _Compare,
1724 __allocator_for<_KeyContainer, _MappedContainer> _Alloc>
1725 flat_multimap(sorted_equivalent_t, _KeyContainer, _MappedContainer, _Compare, _Alloc)
1726 -> flat_multimap<
typename _KeyContainer::value_type,
typename _MappedContainer::value_type,
1727 _Compare, _KeyContainer, _MappedContainer>;
1729 template<__has_input_iter_cat _InputIterator,
1731 flat_multimap(_InputIterator, _InputIterator, _Compare = _Compare())
1732 -> flat_multimap<__iter_key_t<_InputIterator>, __iter_val_t<_InputIterator>, _Compare>;
1734 template<__has_input_iter_cat _InputIterator,
1736 flat_multimap(sorted_equivalent_t, _InputIterator, _InputIterator, _Compare = _Compare())
1737 -> flat_multimap<__iter_key_t<_InputIterator>, __iter_val_t<_InputIterator>, _Compare>;
1742 flat_multimap(from_range_t, _Rg&&, _Compare = _Compare(), _Alloc = _Alloc())
1743 -> flat_multimap<__detail::__range_key_type<_Rg>, __detail::__range_mapped_type<_Rg>,
1746 __alloc_rebind<_Alloc, __detail::__range_key_type<_Rg>>>,
1748 __alloc_rebind<_Alloc, __detail::__range_mapped_type<_Rg>>>>;
1750 template<ranges::input_range _Rg, __allocator_like _Alloc>
1751 flat_multimap(from_range_t, _Rg&&, _Alloc)
1752 -> flat_multimap<__detail::__range_key_type<_Rg>, __detail::__range_mapped_type<_Rg>,
1755 __alloc_rebind<_Alloc, __detail::__range_key_type<_Rg>>>,
1757 __alloc_rebind<_Alloc, __detail::__range_mapped_type<_Rg>>>>;
1759 template<
typename _Key,
typename _Tp, __not_allocator_like _Compare = less<_Key>>
1761 -> flat_multimap<_Key, _Tp, _Compare>;
1763 template<
typename _Key,
typename _Tp, __not_allocator_like _Compare = less<_Key>>
1765 -> flat_multimap<_Key, _Tp, _Compare>;
1767 template<
typename _Key,
typename _Tp,
typename _Compare,
1768 typename _KeyContainer,
typename _MappedContainer,
typename _Alloc>
1769 struct uses_allocator<flat_multimap<_Key, _Tp, _Compare, _KeyContainer, _MappedContainer>,
1771 : bool_constant<uses_allocator_v<_KeyContainer, _Alloc>
1772 && uses_allocator_v<_MappedContainer, _Alloc>>
1775 template<
typename _Key,
typename _Tp,
typename _Compare,
1776 typename _KeyContainer,
typename _MappedContainer,
typename _Predicate>
1777 _GLIBCXX26_CONSTEXPR
1778 typename flat_multimap<_Key, _Tp, _Compare, _KeyContainer, _MappedContainer>::size_type
1779 erase_if(flat_multimap<_Key, _Tp, _Compare, _KeyContainer, _MappedContainer>& __c,
1781 {
return __c._M_erase_if(
std::move(__pred)); }
1783_GLIBCXX_END_NAMESPACE_VERSION
constexpr complex< _Tp > operator*(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x times y.
constexpr complex< _Tp > operator-(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x minus y.
constexpr complex< _Tp > operator+(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x plus y.
pair(_T1, _T2) -> pair< _T1, _T2 >
Two pairs are equal iff their members are equal.
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
constexpr _Tp && forward(typename std::remove_reference< _Tp >::type &__t) noexcept
Forward an lvalue.
constexpr auto lexicographical_compare_three_way(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2, _Comp __comp) -> decltype(__comp(*__first1, *__first2))
Performs dictionary comparison on ranges.
constexpr const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.
constexpr reverse_iterator< _Iterator > make_reverse_iterator(_Iterator __i)
Generator function for reverse_iterator.
ISO C++ entities toplevel namespace is std.
The standard allocator, as per C++03 [20.4.1].
Declare uses_allocator so it can be specialized in <queue> etc.
One of the comparison functors.
Struct holding two objects (or references) of arbitrary type.
A standard container which offers fixed time access to individual elements in any order.
A range for which ranges::begin returns an input iterator.