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 for (; __first != __last; ++__first)
640 value_type __value = *__first;
641 _M_cont.keys.emplace_back(
std::move(__value.first));
642 _M_cont.values.emplace_back(
std::move(__value.second));
644 auto __zv = views::zip(_M_cont.keys, _M_cont.values);
646 _GLIBCXX_DEBUG_ASSERT(ranges::is_sorted(__zv.begin() + __n, __zv.end(),
649 ranges::sort(__zv.begin() + __n, __zv.end(), value_comp());
650 ranges::inplace_merge(__zv.begin(), __zv.begin() + __n, __zv.end(),
652 if constexpr (!_Multi)
654 __guard._M_disable();
658 template<__has_input_iter_cat _InputIterator>
661 insert(_InputIterator __first, _InputIterator __last)
664 template<__has_input_iter_cat _InputIterator>
667 insert(__sorted_t, _InputIterator __first, _InputIterator __last)
670 template<__detail::__container_compatible_range<value_type> _Rg>
673 insert_range(_Rg&& __rg)
674 { _M_insert(ranges::begin(__rg), ranges::end(__rg)); }
676 template<__detail::__container_compatible_range<value_type> _Rg>
679 insert_range(__sorted_t, _Rg&& __rg)
680 { _M_insert(ranges::begin(__rg), ranges::end(__rg),
true); }
684 insert(initializer_list<value_type> __il)
685 { insert(__il.begin(), __il.end()); }
689 insert(__sorted_t __s, initializer_list<value_type> __il)
690 { insert(__s, __il.begin(), __il.end()); }
696 auto __guard = _M_make_clear_guard();
702 replace(key_container_type&& __key_cont, mapped_container_type&& __mapped_cont)
704 __glibcxx_assert(__key_cont.size() == __mapped_cont.size());
705 _GLIBCXX_DEBUG_ASSERT(ranges::is_sorted(__key_cont, _M_comp));
706 auto __guard = _M_make_clear_guard();
708 _M_cont.values =
std::move(__mapped_cont);
709 __guard._M_disable();
716 erase(iterator __position)
717 {
return erase(
static_cast<const_iterator
>(__position)); }
721 erase(const_iterator __position)
723 auto __guard = _M_make_clear_guard();
724 auto __idx = __position._M_index;
725 auto __it = _M_cont.keys.erase(_M_cont.keys.begin() + __idx);
726 _M_cont.values.erase(_M_cont.values.begin() + __idx);
727 __guard._M_disable();
728 return iterator{
this, __it};
733 erase(
const key_type& __x)
734 {
return erase<const key_type&>(__x); }
736 template<
typename _Key2>
737 requires same_as<remove_cvref_t<_Key2>, _Key>
738 || (__transparent_comparator<_Compare>
739 && !is_convertible_v<_Key2, iterator>
740 && !is_convertible_v<_Key2, const_iterator>)
746 auto __n = __last - __first;
747 erase(__first, __last);
753 erase(const_iterator __first, const_iterator __last)
755 auto __guard = _M_make_clear_guard();
756 auto __it = _M_cont.keys.erase(_M_cont.keys.begin() + __first._M_index,
757 _M_cont.keys.begin() + __last._M_index);
758 _M_cont.values.erase(_M_cont.values.begin() + __first._M_index,
759 _M_cont.values.begin() + __last._M_index);
760 __guard._M_disable();
761 return iterator{
this, __it};
767 noexcept(is_nothrow_swappable_v<key_container_type>
768 && is_nothrow_swappable_v<mapped_container_type>
769 && is_nothrow_swappable_v<key_compare>)
771 auto __guard = _M_make_clear_guard();
772 auto __guard_y = _ClearGuard{__y._M_cont};
773 ranges::swap(_M_cont.keys, __y._M_cont.keys);
774 ranges::swap(_M_cont.values, __y._M_cont.values);
775 ranges::swap(_M_comp, __y._M_comp);
776 __guard._M_disable();
777 __guard_y._M_disable();
784 _M_cont.keys.clear();
785 _M_cont.values.clear();
799 {
return value_compare(_M_comp); }
803 const key_container_type&
804 keys() const noexcept
805 {
return _M_cont.keys; }
809 const mapped_container_type&
810 values() const noexcept
811 {
return _M_cont.values; }
817 find(
const key_type& __x)
818 {
return find<key_type>(__x); }
823 find(
const key_type& __x)
const
824 {
return find<key_type>(__x); }
826 template<
typename _Key2>
827 requires same_as<_Key2, _Key> || __transparent_comparator<_Compare>
831 find(
const _Key2& __x)
833 auto __it = lower_bound(__x);
834 if (__it != end() && !_M_comp(__x, __it->first))
840 template<
typename _Key2>
841 requires same_as<_Key2, _Key> || __transparent_comparator<_Compare>
845 find(
const _Key2& __x)
const
847 auto __it = lower_bound(__x);
848 if (__it != cend() && !_M_comp(__x, __it->first))
857 count(
const key_type& __x)
const
858 {
return count<key_type>(__x); }
860 template<
typename _Key2>
861 requires same_as<_Key2, _Key> || __transparent_comparator<_Compare>
865 count(
const _Key2& __x)
const
867 if constexpr (!_Multi)
868 return contains<_Key2>(__x);
871 auto [__first, __last] = equal_range(__x);
872 return __last - __first;
879 contains(
const key_type& __x)
const
880 {
return contains<key_type>(__x); }
882 template<
typename _Key2>
883 requires same_as<_Key2, _Key> || __transparent_comparator<_Compare>
887 contains(
const _Key2& __x)
const
888 {
return find(__x) != cend(); }
893 lower_bound(
const key_type& __x)
894 {
return lower_bound<key_type>(__x); }
899 lower_bound(
const key_type& __x)
const
900 {
return lower_bound<key_type>(__x); }
902 template<
typename _Key2>
903 requires same_as<_Key2, _Key> || __transparent_comparator<_Compare>
907 lower_bound(
const _Key2& __x)
909 auto __it = std::lower_bound(_M_cont.keys.begin(), _M_cont.keys.end(),
914 template<
typename _Key2>
915 requires same_as<_Key2, _Key> || __transparent_comparator<_Compare>
919 lower_bound(
const _Key2& __x)
const
921 auto __it = std::lower_bound(_M_cont.keys.begin(), _M_cont.keys.end(),
929 upper_bound(
const key_type& __x)
930 {
return upper_bound<key_type>(__x); }
935 upper_bound(
const key_type& __x)
const
936 {
return upper_bound<key_type>(__x); }
938 template<
typename _Key2>
939 requires same_as<_Key2, _Key> || __transparent_comparator<_Compare>
943 upper_bound(
const _Key2& __x)
945 auto __it = std::upper_bound(_M_cont.keys.begin(), _M_cont.keys.end(),
950 template<
typename _Key2>
951 requires same_as<_Key2, _Key> || __transparent_comparator<_Compare>
955 upper_bound(
const _Key2& __x)
const
957 auto __it = std::upper_bound(_M_cont.keys.begin(), _M_cont.keys.end(),
964 pair<iterator, iterator>
965 equal_range(
const key_type& __x)
966 {
return equal_range<key_type>(__x); }
970 pair<const_iterator, const_iterator>
971 equal_range(
const key_type& __x)
const
972 {
return equal_range<key_type>(__x); }
974 template<
typename _Key2>
975 requires same_as<_Key2, _Key> || __transparent_comparator<_Compare>
978 pair<iterator, iterator>
979 equal_range(
const _Key2& __x)
981 auto [__first, __last] = std::equal_range(_M_cont.keys.begin(),
984 return {{
this, __first}, {
this, __last}};
987 template<
typename _Key2>
988 requires same_as<_Key2, _Key> || __transparent_comparator<_Compare>
991 pair<const_iterator, const_iterator>
992 equal_range(
const _Key2& __x)
const
994 auto [__first, __last] = std::equal_range(_M_cont.keys.begin(),
997 return {{
this, __first}, {
this, __last}};
1001 friend _GLIBCXX26_CONSTEXPR
bool
1002 operator==(
const _Derived& __x,
const _Derived& __y)
1004 return __x._M_cont.keys == __y._M_cont.keys
1005 && __x._M_cont.values == __y._M_cont.values;
1008 template<
typename _Up = value_type>
1010 friend _GLIBCXX26_CONSTEXPR __detail::__synth3way_t<_Up>
1011 operator<=>(
const _Derived& __x,
const _Derived& __y)
1014 __y.begin(), __y.end(),
1015 __detail::__synth3way);
1018 friend _GLIBCXX26_CONSTEXPR
void
1019 swap(_Derived& __x, _Derived& __y)
noexcept(
noexcept(__x.swap(__y)))
1020 {
return __x.swap(__y); }
1022 template<
typename _Predicate>
1023 _GLIBCXX26_CONSTEXPR
1025 _M_erase_if(_Predicate __pred)
1027 auto __guard = _M_make_clear_guard();
1028 auto __zv = views::zip(_M_cont.keys, _M_cont.values);
1029 auto __sr = ranges::remove_if(__zv, __pred,
1030 [](
const auto& __e) {
1031 return const_reference(__e);
1033 auto __erased = __sr.size();
1034 erase(end() - __erased, end());
1035 __guard._M_disable();
1041 [[no_unique_address]] _Compare _M_comp;
1043 _GLIBCXX26_CONSTEXPR
1047 auto __zv = views::zip(_M_cont.keys, _M_cont.values);
1048 ranges::sort(__zv, value_comp());
1049 if constexpr (!_Multi)
1053 _GLIBCXX26_CONSTEXPR
1055 _M_unique()
requires (!_Multi)
1059 _GLIBCXX26_CONSTEXPR
1060 __key_equiv(key_compare __c) : _M_comp(__c) { }
1062 _GLIBCXX26_CONSTEXPR
1064 operator()(const_reference __x, const_reference __y)
const
1065 {
return !_M_comp(__x.first, __y.first) && !_M_comp(__y.first, __x.first); }
1067 [[no_unique_address]] key_compare _M_comp;
1070 auto __zv = views::zip(_M_cont.keys, _M_cont.values);
1071 auto __it = ranges::unique(__zv, __key_equiv(_M_comp)).begin();
1072 auto __n = __it - __zv.begin();
1073 _M_cont.keys.erase(_M_cont.keys.begin() + __n, _M_cont.keys.end());
1074 _M_cont.values.erase(_M_cont.values.begin() + __n, _M_cont.values.end());
1078 template<
typename _Key,
typename _Tp,
typename _Compare,
1079 typename _KeyContainer,
typename _MappedContainer,
bool _Multi>
1080 template<
bool _Const>
1081 class _Flat_map_impl<_Key, _Tp, _Compare, _KeyContainer, _MappedContainer, _Multi>::_Iterator
1083 using __size_type =
typename _Flat_map_impl::size_type;
1086 using iterator_category = input_iterator_tag;
1087 using iterator_concept = random_access_iterator_tag;
1088 using value_type = pair<key_type, mapped_type>;
1089 using reference =
pair<
const key_type&,
1090 ranges::__maybe_const_t<_Const, mapped_type>&>;
1091 using difference_type = ptrdiff_t;
1093 _GLIBCXX26_CONSTEXPR
1094 _Iterator() =
default;
1096 _GLIBCXX26_CONSTEXPR
1097 _Iterator(_Iterator<!_Const> __it)
requires _Const
1098 : _M_cont(__it._M_cont), _M_index(__it._M_index)
1101 _GLIBCXX26_CONSTEXPR
1105 __glibcxx_assert(_M_index < _M_cont->keys.size());
1106 return {_M_cont->keys[_M_index], _M_cont->values[_M_index]};
1113 _GLIBCXX26_CONSTEXPR
1115 operator->() const noexcept
1119 _GLIBCXX26_CONSTEXPR
1124 _GLIBCXX26_CONSTEXPR
1126 operator[](difference_type __n)
const noexcept
1127 {
return *(*
this + __n); }
1129 _GLIBCXX26_CONSTEXPR
1131 operator++() noexcept
1137 _GLIBCXX26_CONSTEXPR
1139 operator--() noexcept
1145 _GLIBCXX26_CONSTEXPR
1147 operator++(
int)
noexcept
1154 _GLIBCXX26_CONSTEXPR
1156 operator--(
int)
noexcept
1163 _GLIBCXX26_CONSTEXPR
1165 operator+=(difference_type __n)
noexcept
1171 _GLIBCXX26_CONSTEXPR
1173 operator-=(difference_type __n)
noexcept
1180 friend _Flat_map_impl;
1181 friend _Iterator<!_Const>;
1183 _GLIBCXX26_CONSTEXPR
1184 _Iterator(_Flat_map_impl* __fm,
typename key_container_type::const_iterator __it)
1186 : _M_cont(std::
__addressof(__fm->_M_cont)), _M_index(__it - __fm->keys().cbegin())
1189 _GLIBCXX26_CONSTEXPR
1190 _Iterator(
const _Flat_map_impl* __fm,
typename key_container_type::const_iterator __it)
1192 : _M_cont(
std::__addressof(__fm->_M_cont)), _M_index(__it - __fm->keys().cbegin())
1195 friend _GLIBCXX26_CONSTEXPR _Iterator
1196 operator+(_Iterator __it, difference_type __n)
noexcept
1202 friend _GLIBCXX26_CONSTEXPR _Iterator
1203 operator+(difference_type __n, _Iterator __it)
noexcept
1209 friend _GLIBCXX26_CONSTEXPR _Iterator
1210 operator-(_Iterator __it, difference_type __n)
noexcept
1216 friend _GLIBCXX26_CONSTEXPR difference_type
1217 operator-(
const _Iterator& __x,
const _Iterator& __y)
noexcept
1219 __glibcxx_assert(__x._M_cont == __y._M_cont);
1220 return __x._M_index - __y._M_index;
1223 friend _GLIBCXX26_CONSTEXPR
bool
1224 operator==(
const _Iterator& __x,
const _Iterator& __y)
noexcept
1226 __glibcxx_assert(__x._M_cont == __y._M_cont);
1227 __glibcxx_assert((__x._M_index ==
size_t(-1)) == (__y._M_index ==
size_t(-1)));
1228 return __x._M_index == __y._M_index;
1231 friend _GLIBCXX26_CONSTEXPR strong_ordering
1232 operator<=>(
const _Iterator& __x,
const _Iterator& __y)
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 ranges::__maybe_const_t<_Const, containers>* _M_cont =
nullptr;
1240 __size_type _M_index = -1;
1247 template<
typename _Key,
typename _Tp,
typename _Compare = less<_Key>,
1248 typename _KeyContainer = vector<_Key>,
1249 typename _MappedContainer = vector<_Tp>>
1251 :
private _Flat_map_impl<_Key, _Tp, _Compare, _KeyContainer, _MappedContainer, false>
1253 using _Impl = _Flat_map_impl<_Key, _Tp, _Compare, _KeyContainer, _MappedContainer, false>;
1258 using typename _Impl::key_type;
1259 using typename _Impl::mapped_type;
1260 using typename _Impl::value_type;
1261 using typename _Impl::key_compare;
1262 using typename _Impl::reference;
1263 using typename _Impl::const_reference;
1264 using typename _Impl::size_type;
1265 using typename _Impl::difference_type;
1266 using typename _Impl::iterator;
1267 using typename _Impl::const_iterator;
1268 using typename _Impl::reverse_iterator;
1269 using typename _Impl::const_reverse_iterator;
1270 using typename _Impl::key_container_type;
1271 using typename _Impl::mapped_container_type;
1272 using typename _Impl::value_compare;
1273 using typename _Impl::containers;
1281 using _Impl::operator=;
1286 using _Impl::rbegin;
1289 using _Impl::cbegin;
1291 using _Impl::crbegin;
1297 using _Impl::max_size;
1300 _GLIBCXX26_CONSTEXPR
1302 operator[](
const key_type& __x)
1303 {
return try_emplace(__x).first->second; }
1305 _GLIBCXX26_CONSTEXPR
1307 operator[](key_type&& __x)
1308 {
return try_emplace(
std::move(__x)).first->second; }
1310 template<
typename _Key2>
1311 requires __transparent_comparator<_Compare>
1312 _GLIBCXX26_CONSTEXPR
1314 operator[](_Key2&& __x)
1317 _GLIBCXX26_CONSTEXPR
1319 at(
const key_type& __x)
1320 {
return at<key_type>(__x); }
1322 _GLIBCXX26_CONSTEXPR
1324 at(
const key_type& __x)
const
1325 {
return at<key_type>(__x); }
1327 template<
typename _Key2>
1328 requires same_as<_Key2, _Key> || __transparent_comparator<_Compare>
1329 _GLIBCXX26_CONSTEXPR
1331 at(
const _Key2& __x)
1333 auto __it = this->find(__x);
1334 if (__it == this->end())
1335 __throw_out_of_range(
"flat_map::at");
1336 return __it->second;
1339 template<
typename _Key2>
1340 requires same_as<_Key2, _Key> || __transparent_comparator<_Compare>
1341 _GLIBCXX26_CONSTEXPR
1343 at(
const _Key2& __x)
const
1345 auto __it = this->find(__x);
1346 if (__it == this->end())
1347 __throw_out_of_range(
"flat_map::at");
1348 return __it->second;
1352 using _Impl::emplace;
1353 using _Impl::emplace_hint;
1354 using _Impl::insert;
1355 using _Impl::insert_range;
1356 using _Impl::extract;
1357 using _Impl::replace;
1362 template<
typename... _Args>
1363 requires is_constructible_v<mapped_type, _Args...>
1364 _GLIBCXX26_CONSTEXPR
1365 pair<iterator, bool>
1366 try_emplace(
const key_type& __k, _Args&&... __args)
1369 template<
typename... _Args>
1370 requires is_constructible_v<mapped_type, _Args...>
1371 _GLIBCXX26_CONSTEXPR
1372 pair<iterator, bool>
1373 try_emplace(key_type&& __k, _Args&&... __args)
1375 return _Impl::_M_try_emplace(nullopt,
std::move(__k),
1379 template<
typename _Key2,
typename... _Args>
1380 requires __transparent_comparator<_Compare>
1381 && is_constructible_v<key_type, _Key2>
1382 && is_constructible_v<mapped_type, _Args...>
1383 && (!is_convertible_v<_Key2&&, const_iterator>)
1384 && (!is_convertible_v<_Key2&&, iterator>)
1385 _GLIBCXX26_CONSTEXPR
1386 pair<iterator, bool>
1387 try_emplace(_Key2&& __k, _Args&&... __args)
1393 template<
typename... _Args>
1394 requires is_constructible_v<mapped_type, _Args...>
1395 _GLIBCXX26_CONSTEXPR
1397 try_emplace(const_iterator __hint,
const key_type& __k, _Args&&... __args)
1400 template<
typename... _Args>
1401 requires is_constructible_v<mapped_type, _Args...>
1402 _GLIBCXX26_CONSTEXPR
1404 try_emplace(const_iterator __hint, key_type&& __k, _Args&&... __args)
1406 return _Impl::_M_try_emplace(__hint,
std::move(__k),
1410 template<
typename _Key2,
typename... _Args>
1411 requires __transparent_comparator<_Compare>
1412 && is_constructible_v<key_type, _Key2>
1413 && is_constructible_v<mapped_type, _Args...>
1414 _GLIBCXX26_CONSTEXPR
1416 try_emplace(const_iterator __hint, _Key2&& __k, _Args&&... __args)
1422 template<
typename _Mapped>
1423 requires is_assignable_v<mapped_type&, _Mapped>
1424 && is_constructible_v<mapped_type, _Mapped>
1425 _GLIBCXX26_CONSTEXPR
1426 pair<iterator, bool>
1427 insert_or_assign(
const key_type& __k, _Mapped&& __obj)
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(key_type&& __k, _Mapped&& __obj)
1437 return insert_or_assign<key_type, _Mapped>(
std::move(__k),
1441 template<
typename _Key2,
typename _Mapped>
1442 requires (same_as<remove_cvref_t<_Key2>, _Key> || __transparent_comparator<_Compare>)
1443 && is_constructible_v<key_type, _Key2>
1444 && is_assignable_v<mapped_type&, _Mapped>
1445 && is_constructible_v<mapped_type, _Mapped>
1446 _GLIBCXX26_CONSTEXPR
1447 pair<iterator, bool>
1448 insert_or_assign(_Key2&& __k, _Mapped&& __obj)
1457 template<
typename _Mapped>
1458 requires is_assignable_v<mapped_type&, _Mapped>
1459 && is_constructible_v<mapped_type, _Mapped>
1460 _GLIBCXX26_CONSTEXPR
1462 insert_or_assign(const_iterator __hint,
const key_type& __k, _Mapped&& __obj)
1464 return insert_or_assign<const key_type&, _Mapped>(__hint, __k,
1468 template<
typename _Mapped>
1469 requires is_assignable_v<mapped_type&, _Mapped>
1470 && is_constructible_v<mapped_type, _Mapped>
1471 _GLIBCXX26_CONSTEXPR
1473 insert_or_assign(const_iterator __hint, key_type&& __k, _Mapped&& __obj)
1475 return insert_or_assign<key_type, _Mapped>(__hint,
std::move(__k),
1479 template<
typename _Key2,
typename _Mapped>
1480 requires (same_as<remove_cvref_t<_Key2>, _Key> || __transparent_comparator<_Compare>)
1481 && is_constructible_v<key_type, _Key2>
1482 && is_assignable_v<mapped_type&, _Mapped>
1483 && is_constructible_v<mapped_type, _Mapped>
1484 _GLIBCXX26_CONSTEXPR
1486 insert_or_assign(const_iterator __hint, _Key2&& __k, _Mapped&& __obj)
1496 using _Impl::key_comp;
1497 using _Impl::value_comp;
1499 using _Impl::values;
1504 using _Impl::contains;
1505 using _Impl::lower_bound;
1506 using _Impl::upper_bound;
1507 using _Impl::equal_range;
1509 using _Impl::_M_erase_if;
1512 template<
typename _KeyContainer,
typename _MappedContainer,
1514 flat_map(_KeyContainer, _MappedContainer, _Compare = _Compare())
1515 -> flat_map<
typename _KeyContainer::value_type,
typename _MappedContainer::value_type,
1516 _Compare, _KeyContainer, _MappedContainer>;
1518 template<
typename _KeyContainer,
typename _MappedContainer,
1519 __allocator_for<_KeyContainer, _MappedContainer> _Alloc>
1520 flat_map(_KeyContainer, _MappedContainer, _Alloc)
1521 -> flat_map<
typename _KeyContainer::value_type,
typename _MappedContainer::value_type,
1524 template<
typename _KeyContainer,
typename _MappedContainer, __not_allocator_like _Compare,
1525 __allocator_for<_KeyContainer, _MappedContainer> _Alloc>
1526 flat_map(_KeyContainer, _MappedContainer, _Compare, _Alloc)
1527 -> flat_map<
typename _KeyContainer::value_type,
typename _MappedContainer::value_type,
1528 _Compare, _KeyContainer, _MappedContainer>;
1530 template<
typename _KeyContainer,
typename _MappedContainer,
1532 flat_map(sorted_unique_t, _KeyContainer, _MappedContainer, _Compare = _Compare())
1533 -> flat_map<
typename _KeyContainer::value_type,
typename _MappedContainer::value_type,
1534 _Compare, _KeyContainer, _MappedContainer>;
1536 template<
typename _KeyContainer,
typename _MappedContainer,
1537 __allocator_for<_KeyContainer, _MappedContainer> _Alloc>
1538 flat_map(sorted_unique_t, _KeyContainer, _MappedContainer, _Alloc)
1539 -> flat_map<
typename _KeyContainer::value_type,
typename _MappedContainer::value_type,
1542 template<
typename _KeyContainer,
typename _MappedContainer, __not_allocator_like _Compare,
1543 __allocator_for<_KeyContainer, _MappedContainer> _Alloc>
1544 flat_map(sorted_unique_t, _KeyContainer, _MappedContainer, _Compare, _Alloc)
1545 -> flat_map<
typename _KeyContainer::value_type,
typename _MappedContainer::value_type,
1546 _Compare, _KeyContainer, _MappedContainer>;
1548 template<__has_input_iter_cat _InputIterator,
1550 flat_map(_InputIterator, _InputIterator, _Compare = _Compare())
1551 -> flat_map<__iter_key_t<_InputIterator>, __iter_val_t<_InputIterator>, _Compare>;
1553 template<__has_input_iter_cat _InputIterator,
1555 flat_map(sorted_unique_t, _InputIterator, _InputIterator, _Compare = _Compare())
1556 -> flat_map<__iter_key_t<_InputIterator>, __iter_val_t<_InputIterator>, _Compare>;
1561 flat_map(from_range_t, _Rg&&, _Compare = _Compare(), _Alloc = _Alloc())
1562 -> flat_map<__detail::__range_key_type<_Rg>, __detail::__range_mapped_type<_Rg>,
1565 __alloc_rebind<_Alloc, __detail::__range_key_type<_Rg>>>,
1567 __alloc_rebind<_Alloc, __detail::__range_mapped_type<_Rg>>>>;
1569 template<ranges::input_range _Rg, __allocator_like _Alloc>
1570 flat_map(from_range_t, _Rg&&, _Alloc)
1571 -> flat_map<__detail::__range_key_type<_Rg>, __detail::__range_mapped_type<_Rg>,
1574 __alloc_rebind<_Alloc, __detail::__range_key_type<_Rg>>>,
1576 __alloc_rebind<_Alloc, __detail::__range_mapped_type<_Rg>>>>;
1578 template<
typename _Key,
typename _Tp, __not_allocator_like _Compare = less<_Key>>
1580 -> flat_map<_Key, _Tp, _Compare>;
1582 template<
typename _Key,
typename _Tp, __not_allocator_like _Compare = less<_Key>>
1584 -> flat_map<_Key, _Tp, _Compare>;
1586 template<
typename _Key,
typename _Tp,
typename _Compare,
1587 typename _KeyContainer,
typename _MappedContainer,
typename _Alloc>
1588 struct uses_allocator<flat_map<_Key, _Tp, _Compare, _KeyContainer, _MappedContainer>, _Alloc>
1589 : bool_constant<uses_allocator_v<_KeyContainer, _Alloc>
1590 && uses_allocator_v<_MappedContainer, _Alloc>>
1593 template<
typename _Key,
typename _Tp,
typename _Compare,
1594 typename _KeyContainer,
typename _MappedContainer,
typename _Predicate>
1595 _GLIBCXX26_CONSTEXPR
1596 typename flat_map<_Key, _Tp, _Compare, _KeyContainer, _MappedContainer>::size_type
1597 erase_if(flat_map<_Key, _Tp, _Compare, _KeyContainer, _MappedContainer>& __c,
1599 {
return __c._M_erase_if(
std::move(__pred)); }
1605 template<
typename _Key,
typename _Tp,
typename _Compare = less<_Key>,
1606 typename _KeyContainer = vector<_Key>,
1607 typename _MappedContainer = vector<_Tp>>
1609 :
private _Flat_map_impl<_Key, _Tp, _Compare, _KeyContainer, _MappedContainer, true>
1611 using _Impl = _Flat_map_impl<_Key, _Tp, _Compare, _KeyContainer, _MappedContainer, true>;
1616 using typename _Impl::key_type;
1617 using typename _Impl::mapped_type;
1618 using typename _Impl::value_type;
1619 using typename _Impl::key_compare;
1620 using typename _Impl::reference;
1621 using typename _Impl::const_reference;
1622 using typename _Impl::size_type;
1623 using typename _Impl::difference_type;
1624 using typename _Impl::iterator;
1625 using typename _Impl::const_iterator;
1626 using typename _Impl::reverse_iterator;
1627 using typename _Impl::const_reverse_iterator;
1628 using typename _Impl::key_container_type;
1629 using typename _Impl::mapped_container_type;
1630 using typename _Impl::value_compare;
1631 using typename _Impl::containers;
1639 using _Impl::operator=;
1644 using _Impl::rbegin;
1647 using _Impl::cbegin;
1649 using _Impl::crbegin;
1655 using _Impl::max_size;
1658 using _Impl::emplace;
1659 using _Impl::emplace_hint;
1660 using _Impl::insert;
1661 using _Impl::insert_range;
1662 using _Impl::extract;
1663 using _Impl::replace;
1669 using _Impl::key_comp;
1670 using _Impl::value_comp;
1672 using _Impl::values;
1677 using _Impl::contains;
1678 using _Impl::lower_bound;
1679 using _Impl::upper_bound;
1680 using _Impl::equal_range;
1682 using _Impl::_M_erase_if;
1685 template<
typename _KeyContainer,
typename _MappedContainer,
1687 flat_multimap(_KeyContainer, _MappedContainer, _Compare = _Compare())
1688 -> flat_multimap<
typename _KeyContainer::value_type,
typename _MappedContainer::value_type,
1689 _Compare, _KeyContainer, _MappedContainer>;
1691 template<
typename _KeyContainer,
typename _MappedContainer,
1692 __allocator_for<_KeyContainer, _MappedContainer> _Alloc>
1693 flat_multimap(_KeyContainer, _MappedContainer, _Alloc)
1694 -> flat_multimap<
typename _KeyContainer::value_type,
typename _MappedContainer::value_type,
1697 template<
typename _KeyContainer,
typename _MappedContainer, __not_allocator_like _Compare,
1698 __allocator_for<_KeyContainer, _MappedContainer> _Alloc>
1699 flat_multimap(_KeyContainer, _MappedContainer, _Compare, _Alloc)
1700 -> flat_multimap<
typename _KeyContainer::value_type,
typename _MappedContainer::value_type,
1701 _Compare, _KeyContainer, _MappedContainer>;
1703 template<
typename _KeyContainer,
typename _MappedContainer,
1705 flat_multimap(sorted_equivalent_t, _KeyContainer, _MappedContainer, _Compare = _Compare())
1706 -> flat_multimap<
typename _KeyContainer::value_type,
typename _MappedContainer::value_type,
1707 _Compare, _KeyContainer, _MappedContainer>;
1709 template<
typename _KeyContainer,
typename _MappedContainer,
1710 __allocator_for<_KeyContainer, _MappedContainer> _Alloc>
1711 flat_multimap(sorted_equivalent_t, _KeyContainer, _MappedContainer, _Alloc)
1712 -> flat_multimap<
typename _KeyContainer::value_type,
typename _MappedContainer::value_type,
1715 template<
typename _KeyContainer,
typename _MappedContainer, __not_allocator_like _Compare,
1716 __allocator_for<_KeyContainer, _MappedContainer> _Alloc>
1717 flat_multimap(sorted_equivalent_t, _KeyContainer, _MappedContainer, _Compare, _Alloc)
1718 -> flat_multimap<
typename _KeyContainer::value_type,
typename _MappedContainer::value_type,
1719 _Compare, _KeyContainer, _MappedContainer>;
1721 template<__has_input_iter_cat _InputIterator,
1723 flat_multimap(_InputIterator, _InputIterator, _Compare = _Compare())
1724 -> flat_multimap<__iter_key_t<_InputIterator>, __iter_val_t<_InputIterator>, _Compare>;
1726 template<__has_input_iter_cat _InputIterator,
1728 flat_multimap(sorted_equivalent_t, _InputIterator, _InputIterator, _Compare = _Compare())
1729 -> flat_multimap<__iter_key_t<_InputIterator>, __iter_val_t<_InputIterator>, _Compare>;
1734 flat_multimap(from_range_t, _Rg&&, _Compare = _Compare(), _Alloc = _Alloc())
1735 -> flat_multimap<__detail::__range_key_type<_Rg>, __detail::__range_mapped_type<_Rg>,
1738 __alloc_rebind<_Alloc, __detail::__range_key_type<_Rg>>>,
1740 __alloc_rebind<_Alloc, __detail::__range_mapped_type<_Rg>>>>;
1742 template<ranges::input_range _Rg, __allocator_like _Alloc>
1743 flat_multimap(from_range_t, _Rg&&, _Alloc)
1744 -> flat_multimap<__detail::__range_key_type<_Rg>, __detail::__range_mapped_type<_Rg>,
1747 __alloc_rebind<_Alloc, __detail::__range_key_type<_Rg>>>,
1749 __alloc_rebind<_Alloc, __detail::__range_mapped_type<_Rg>>>>;
1751 template<
typename _Key,
typename _Tp, __not_allocator_like _Compare = less<_Key>>
1753 -> flat_multimap<_Key, _Tp, _Compare>;
1755 template<
typename _Key,
typename _Tp, __not_allocator_like _Compare = less<_Key>>
1757 -> flat_multimap<_Key, _Tp, _Compare>;
1759 template<
typename _Key,
typename _Tp,
typename _Compare,
1760 typename _KeyContainer,
typename _MappedContainer,
typename _Alloc>
1761 struct uses_allocator<flat_multimap<_Key, _Tp, _Compare, _KeyContainer, _MappedContainer>,
1763 : bool_constant<uses_allocator_v<_KeyContainer, _Alloc>
1764 && uses_allocator_v<_MappedContainer, _Alloc>>
1767 template<
typename _Key,
typename _Tp,
typename _Compare,
1768 typename _KeyContainer,
typename _MappedContainer,
typename _Predicate>
1769 _GLIBCXX26_CONSTEXPR
1770 typename flat_multimap<_Key, _Tp, _Compare, _KeyContainer, _MappedContainer>::size_type
1771 erase_if(flat_multimap<_Key, _Tp, _Compare, _KeyContainer, _MappedContainer>& __c,
1773 {
return __c._M_erase_if(
std::move(__pred)); }
1775_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.