61 #if __cplusplus >= 201103L
65 #if __glibcxx_containers_ranges
70 namespace std _GLIBCXX_VISIBILITY(default)
72 _GLIBCXX_BEGIN_NAMESPACE_VERSION
73 _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
75 template <
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
104 template <
typename _Key,
typename _Tp,
typename _Compare = std::less<_Key>,
105 typename _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
109 typedef _Key key_type;
110 typedef _Tp mapped_type;
112 typedef _Compare key_compare;
113 typedef _Alloc allocator_type;
116 #ifdef _GLIBCXX_CONCEPT_CHECKS
118 typedef typename _Alloc::value_type _Alloc_value_type;
119 # if __cplusplus < 201103L
120 __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
122 __glibcxx_class_requires4(_Compare,
bool, _Key, _Key,
123 _BinaryFunctionConcept)
124 __glibcxx_class_requires2(
value_type, _Alloc_value_type, _SameTypeConcept)
127 #if __cplusplus >= 201103L
128 #if __cplusplus > 201703L || defined __STRICT_ANSI__
130 "std::map must have the same value_type as its allocator");
135 #pragma GCC diagnostic push
136 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
140 friend class map<_Key, _Tp, _Compare, _Alloc>;
144 value_compare(_Compare __c)
151 #pragma GCC diagnostic pop
156 rebind<value_type>::other _Pair_alloc_type;
158 typedef _Rb_tree<key_type, value_type, _Select1st<value_type>,
159 key_compare, _Pair_alloc_type> _Rep_type;
166 #if __cplusplus >= 201703L
167 template<
typename _Up,
typename _Vp = remove_reference_t<_Up>>
168 static constexpr
bool __usable_key
169 = __or_v<is_same<const _Vp, const _Key>,
176 typedef typename _Alloc_traits::pointer pointer;
177 typedef typename _Alloc_traits::const_pointer const_pointer;
178 typedef typename _Alloc_traits::reference reference;
179 typedef typename _Alloc_traits::const_reference const_reference;
180 typedef typename _Rep_type::iterator iterator;
181 typedef typename _Rep_type::const_iterator const_iterator;
182 typedef typename _Rep_type::size_type size_type;
183 typedef typename _Rep_type::difference_type difference_type;
187 #ifdef __glibcxx_node_extract
198 #if __cplusplus < 201103L
210 map(
const _Compare& __comp,
211 const allocator_type& __a = allocator_type())
212 : _M_t(__comp, _Pair_alloc_type(__a)) { }
219 #if __cplusplus < 201103L
245 const _Compare& __comp = _Compare(),
246 const allocator_type& __a = allocator_type())
247 : _M_t(__comp, _Pair_alloc_type(__a))
248 { _M_t._M_insert_range_unique(__l.begin(), __l.end()); }
252 map(
const allocator_type& __a)
253 : _M_t(_Pair_alloc_type(__a)) { }
256 map(
const map& __m,
const __type_identity_t<allocator_type>& __a)
257 : _M_t(__m._M_t, _Pair_alloc_type(__a)) { }
260 map(
map&& __m,
const __type_identity_t<allocator_type>& __a)
262 && _Alloc_traits::_S_always_equal())
263 : _M_t(
std::
move(__m._M_t), _Pair_alloc_type(__a)) { }
267 : _M_t(_Pair_alloc_type(__a))
268 { _M_t._M_insert_range_unique(__l.begin(), __l.end()); }
271 template<
typename _InputIterator>
272 map(_InputIterator __first, _InputIterator __last,
273 const allocator_type& __a)
274 : _M_t(_Pair_alloc_type(__a))
275 { _M_t._M_insert_range_unique(__first, __last); }
288 template<
typename _InputIterator>
289 map(_InputIterator __first, _InputIterator __last)
291 { _M_t._M_insert_range_unique(__first, __last); }
305 template<
typename _InputIterator>
306 map(_InputIterator __first, _InputIterator __last,
307 const _Compare& __comp,
308 const allocator_type& __a = allocator_type())
309 : _M_t(__comp, _Pair_alloc_type(__a))
310 { _M_t._M_insert_range_unique(__first, __last); }
312 #if __glibcxx_containers_ranges
317 template<__detail::__container_compatible_range<value_type> _Rg>
318 map(from_range_t, _Rg&& __rg,
319 const _Compare& __comp,
320 const _Alloc& __a = _Alloc())
321 : _M_t(__comp, _Pair_alloc_type(__a))
322 { insert_range(std::forward<_Rg>(__rg)); }
325 template<__detail::__container_compatible_range<value_type> _Rg>
326 map(from_range_t, _Rg&& __rg,
const _Alloc& __a = _Alloc())
327 : _M_t(_Pair_alloc_type(__a))
328 { insert_range(std::forward<_Rg>(__rg)); }
332 #if __cplusplus >= 201103L
346 #if __cplusplus < 201103L
375 _M_t._M_assign_unique(__l.begin(), __l.end());
383 {
return allocator_type(_M_t.get_allocator()); }
393 {
return _M_t.begin(); }
402 {
return _M_t.begin(); }
411 {
return _M_t.end(); }
419 end() const _GLIBCXX_NOEXCEPT
420 {
return _M_t.end(); }
429 {
return _M_t.rbegin(); }
436 const_reverse_iterator
438 {
return _M_t.rbegin(); }
447 {
return _M_t.rend(); }
454 const_reverse_iterator
456 {
return _M_t.rend(); }
458 #if __cplusplus >= 201103L
466 {
return _M_t.begin(); }
475 {
return _M_t.end(); }
482 const_reverse_iterator
484 {
return _M_t.rbegin(); }
491 const_reverse_iterator
493 {
return _M_t.rend(); }
500 _GLIBCXX_NODISCARD
bool
502 {
return _M_t.empty(); }
507 {
return _M_t.size(); }
512 {
return _M_t.max_size(); }
534 __glibcxx_function_requires(_DefaultConstructibleConcept<mapped_type>)
539 #if __cplusplus >= 201103L
546 return (*__i).second;
549 #if __cplusplus >= 201103L
554 __glibcxx_function_requires(_DefaultConstructibleConcept<mapped_type>)
562 return (*__i).second;
566 #ifdef __glibcxx_associative_heterogeneous_insertion
567 template <__heterogeneous_tree_key<map> _Kt>
570 {
return try_emplace(std::forward<_Kt>(__k)).first->second; }
586 at(
const key_type& __k)
590 __throw_out_of_range(__N(
"map::at"));
591 return (*__i).second;
594 #ifdef __glibcxx_associative_heterogeneous_insertion
595 template <__heterogeneous_tree_key<map> _Kt>
601 __throw_out_of_range(__N(
"map::at"));
602 return (*__i).second;
607 at(
const key_type& __k)
const
611 __throw_out_of_range(__N(
"map::at"));
612 return (*__i).second;
615 #ifdef __glibcxx_associative_heterogeneous_insertion
616 template <__heterogeneous_tree_key<map> _Kt>
618 at(
const _Kt& __k)
const
622 __throw_out_of_range(__N(
"map::at"));
623 return (*__i).second;
628 #if __cplusplus >= 201103L
647 template<
typename... _Args>
651 #if __cplusplus >= 201703L
652 if constexpr (
sizeof...(_Args) == 2)
655 auto&& [__a, __v] =
pair<_Args&...>(__args...);
656 if constexpr (__usable_key<decltype(__a)>)
658 const key_type& __k = __a;
662 __i =
emplace_hint(__i, std::forward<_Args>(__args)...);
669 return _M_t._M_emplace_unique(std::forward<_Args>(__args)...);
697 template<
typename... _Args>
701 return _M_t._M_emplace_hint_unique(__pos,
702 std::forward<_Args>(__args)...);
706 #ifdef __glibcxx_node_extract
711 __glibcxx_assert(__pos !=
end());
712 return _M_t.extract(__pos);
718 {
return _M_t.extract(__x); }
720 #ifdef __glibcxx_associative_heterogeneous_erasure
721 template <__heterogeneous_tree_key<map> _Kt>
724 {
return _M_t._M_extract_tr(__key); }
730 {
return _M_t._M_reinsert_node_unique(
std::move(__nh)); }
734 insert(const_iterator __hint, node_type&& __nh)
735 {
return _M_t._M_reinsert_node_hint_unique(__hint,
std::move(__nh)); }
737 template<
typename,
typename>
738 friend struct std::_Rb_tree_merge_helper;
740 template<
typename _Cmp2>
744 using _Merge_helper = _Rb_tree_merge_helper<map, _Cmp2>;
745 _M_t._M_merge_unique(_Merge_helper::_S_get_tree(__source));
748 template<
typename _Cmp2>
750 merge(map<_Key, _Tp, _Cmp2, _Alloc>&& __source)
753 template<
typename _Cmp2>
755 merge(multimap<_Key, _Tp, _Cmp2, _Alloc>& __source)
757 using _Merge_helper = _Rb_tree_merge_helper<map, _Cmp2>;
758 _M_t._M_merge_unique(_Merge_helper::_S_get_tree(__source));
761 template<
typename _Cmp2>
763 merge(multimap<_Key, _Tp, _Cmp2, _Alloc>&& __source)
767 #ifdef __glibcxx_map_try_emplace
791 template <
typename... _Args>
801 std::forward<_Args>(__args)...));
808 template <
typename... _Args>
818 std::forward<_Args>(__args)...));
824 #ifdef __glibcxx_associative_heterogeneous_insertion
825 template <__heterogeneous_tree_key<map> _Kt,
typename ..._Args>
830 auto [__left, __node] = _M_t._M_get_insert_unique_pos_tr(__k);
833 __i = _M_t._M_emplace_here(__left == __node, __node,
837 return { __i,
true };
839 __i = iterator(__left);
840 return { __i,
false };
874 template <
typename... _Args>
880 auto __true_hint = _M_t._M_get_insert_hint_unique_pos(__hint, __k);
881 if (__true_hint.second)
886 std::forward<_Args>(__args)...));
888 __i = iterator(__true_hint.first);
893 template <
typename... _Args>
895 try_emplace(const_iterator __hint, key_type&& __k, _Args&&... __args)
898 auto __true_hint = _M_t._M_get_insert_hint_unique_pos(__hint, __k);
899 if (__true_hint.second)
904 std::forward<_Args>(__args)...));
911 #ifdef __glibcxx_associative_heterogeneous_insertion
912 template <__heterogeneous_tree_key<map> _Kt,
typename ..._Args>
914 try_emplace(const_iterator __hint, _Kt&& __k, _Args&&... __args)
917 auto [__left, __node] =
918 _M_t._M_get_insert_hint_unique_pos_tr(__hint, __k);
921 __i = _M_t._M_emplace_here(__left == __node, __node,
926 else __i = iterator(__left);
949 {
return _M_t._M_insert_unique(__x); }
951 #if __cplusplus >= 201103L
956 {
return _M_t._M_insert_unique(
std::move(__x)); }
958 template<
typename _Pair>
959 __enable_if_t<is_constructible<value_type, _Pair>::value,
963 #if __cplusplus >= 201703L
965 if constexpr (__is_pair<remove_const_t<_P2>>)
967 if constexpr (__usable_key<typename _P2::first_type>)
969 const key_type& __k = __x.first;
979 return _M_t._M_emplace_unique(std::forward<_Pair>(__x));
984 #if __cplusplus >= 201103L
994 {
insert(__list.begin(), __list.end()); }
997 #if __glibcxx_containers_ranges
1004 template<__detail::__container_compatible_range<value_type> _Rg>
1006 insert_range(_Rg&& __rg)
1008 auto __first = ranges::begin(__rg);
1009 const auto __last = ranges::end(__rg);
1010 for (; __first != __last; ++__first)
1040 #if __cplusplus >= 201103L
1045 {
return _M_t._M_insert_unique_(__position, __x); }
1047 #if __cplusplus >= 201103L
1052 {
return _M_t._M_insert_unique_(__position,
std::move(__x)); }
1054 template<
typename _Pair>
1055 __enable_if_t<is_constructible<value_type, _Pair>::value,
iterator>
1056 insert(const_iterator __position, _Pair&& __x)
1058 return _M_t._M_emplace_hint_unique(__position,
1059 std::forward<_Pair>(__x));
1072 template<
typename _InputIterator>
1074 insert(_InputIterator __first, _InputIterator __last)
1075 { _M_t._M_insert_range_unique(__first, __last); }
1077 #if __cplusplus > 201402L
1097 template <
typename _Obj>
1102 if (__i ==
end() ||
key_comp()(__k, (*__i).first))
1107 std::forward<_Obj>(__obj)));
1110 (*__i).second = std::forward<_Obj>(__obj);
1111 return {__i,
false};
1115 template <
typename _Obj>
1120 if (__i ==
end() ||
key_comp()(__k, (*__i).first))
1125 std::forward<_Obj>(__obj)));
1128 (*__i).second = std::forward<_Obj>(__obj);
1129 return {__i,
false};
1132 #ifdef __glibcxx_associative_heterogeneous_insertion
1133 template <__heterogeneous_tree_key<map> _Kt,
typename _Obj>
1134 pair<iterator, bool>
1138 auto [__left, __node] =_M_t._M_get_insert_unique_pos_tr(__k);
1141 __i = _M_t._M_emplace_here(__left == __node, __node,
1145 return { __i,
true };
1147 __i = iterator(__left);
1148 (*__i).second = std::forward<_Obj>(__obj);
1149 return { __i,
false };
1155 #if __cplusplus > 201402L
1180 template <
typename _Obj>
1183 const key_type& __k, _Obj&& __obj)
1186 auto __true_hint = _M_t._M_get_insert_hint_unique_pos(__hint, __k);
1187 if (__true_hint.second)
1193 std::forward<_Obj>(__obj)));
1195 __i = iterator(__true_hint.first);
1196 (*__i).second = std::forward<_Obj>(__obj);
1201 template <
typename _Obj>
1206 auto __true_hint = _M_t._M_get_insert_hint_unique_pos(__hint, __k);
1207 if (__true_hint.second)
1213 std::forward<_Obj>(__obj)));
1215 __i = iterator(__true_hint.first);
1216 (*__i).second = std::forward<_Obj>(__obj);
1220 #ifdef __glibcxx_associative_heterogeneous_insertion
1221 template <__heterogeneous_tree_key<map> _Kt,
typename _Obj>
1226 auto [__left, __node] =
1227 _M_t._M_get_insert_hint_unique_pos_tr(__hint, __k);
1230 return _M_t._M_emplace_here(__left == __node, __node,
1235 __i = iterator(__left);
1236 (*__i).second = std::forward<_Obj>(__obj);
1243 #if __cplusplus >= 201103L
1263 {
return _M_t.erase(__position); }
1266 _GLIBCXX_ABI_TAG_CXX11
1269 {
return _M_t.erase(__position); }
1284 { _M_t.erase(__position); }
1301 {
return _M_t._M_erase_unique(__x); }
1303 #ifdef __glibcxx_associative_heterogeneous_erasure
1307 template <__heterogeneous_tree_key<map> _Kt>
1310 {
return _M_t._M_erase_tr(__x); }
1314 #if __cplusplus >= 201103L
1331 erase(const_iterator __first, const_iterator __last)
1332 {
return _M_t.erase(__first, __last); }
1348 { _M_t.erase(__first, __last); }
1366 _GLIBCXX_NOEXCEPT_IF(__is_nothrow_swappable<_Compare>::value)
1367 { _M_t.swap(__x._M_t); }
1386 {
return _M_t.key_comp(); }
1394 {
return value_compare(_M_t.key_comp()); }
1413 {
return _M_t.find(__x); }
1415 #ifdef __glibcxx_generic_associative_lookup
1416 template<
typename _Kt>
1418 find(
const _Kt& __x) -> decltype(_M_t._M_find_tr(__x))
1419 {
return _M_t._M_find_tr(__x); }
1438 {
return _M_t.find(__x); }
1440 #ifdef __glibcxx_generic_associative_lookup
1441 template<
typename _Kt>
1443 find(
const _Kt& __x)
const -> decltype(_M_t._M_find_tr(__x))
1444 {
return _M_t._M_find_tr(__x); }
1459 {
return _M_t.find(__x) == _M_t.end() ? 0 : 1; }
1461 #ifdef __glibcxx_generic_associative_lookup
1462 template<
typename _Kt>
1464 count(
const _Kt& __x)
const -> decltype(_M_t._M_count_tr(__x))
1465 {
return _M_t._M_count_tr(__x); }
1469 #if __cplusplus > 201703L
1478 {
return _M_t.find(__x) != _M_t.end(); }
1480 template<
typename _Kt>
1483 -> decltype(_M_t._M_find_tr(__x),
void(),
true)
1484 {
return _M_t._M_find_tr(__x) != _M_t.end(); }
1502 {
return _M_t.lower_bound(__x); }
1504 #ifdef __glibcxx_generic_associative_lookup
1505 template<
typename _Kt>
1508 -> decltype(iterator(_M_t._M_lower_bound_tr(__x)))
1509 {
return iterator(_M_t._M_lower_bound_tr(__x)); }
1527 {
return _M_t.lower_bound(__x); }
1529 #ifdef __glibcxx_generic_associative_lookup
1530 template<
typename _Kt>
1533 -> decltype(const_iterator(_M_t._M_lower_bound_tr(__x)))
1534 {
return const_iterator(_M_t._M_lower_bound_tr(__x)); }
1547 {
return _M_t.upper_bound(__x); }
1549 #ifdef __glibcxx_generic_associative_lookup
1550 template<
typename _Kt>
1553 -> decltype(iterator(_M_t._M_upper_bound_tr(__x)))
1554 {
return iterator(_M_t._M_upper_bound_tr(__x)); }
1567 {
return _M_t.upper_bound(__x); }
1569 #ifdef __glibcxx_generic_associative_lookup
1570 template<
typename _Kt>
1573 -> decltype(const_iterator(_M_t._M_upper_bound_tr(__x)))
1574 {
return const_iterator(_M_t._M_upper_bound_tr(__x)); }
1596 {
return _M_t.equal_range(__x); }
1598 #ifdef __glibcxx_generic_associative_lookup
1599 template<
typename _Kt>
1625 {
return _M_t.equal_range(__x); }
1627 #ifdef __glibcxx_generic_associative_lookup
1628 template<
typename _Kt>
1632 _M_t._M_equal_range_tr(__x)))
1635 _M_t._M_equal_range_tr(__x));
1640 template<
typename _K1,
typename _T1,
typename _C1,
typename _A1>
1645 #if __cpp_lib_three_way_comparison
1646 template<
typename _K1,
typename _T1,
typename _C1,
typename _A1>
1647 friend __detail::__synth3way_t<pair<const _K1, _T1>>
1651 template<
typename _K1,
typename _T1,
typename _C1,
typename _A1>
1659 #if __cpp_deduction_guides >= 201606
1661 template<
typename _InputIterator,
1662 typename _Compare = less<__iter_key_t<_InputIterator>>,
1663 typename _Allocator = allocator<__iter_to_alloc_t<_InputIterator>>,
1664 typename = _RequireInputIter<_InputIterator>,
1665 typename = _RequireNotAllocator<_Compare>,
1666 typename = _RequireAllocator<_Allocator>>
1667 map(_InputIterator, _InputIterator,
1668 _Compare = _Compare(), _Allocator = _Allocator())
1669 -> map<__iter_key_t<_InputIterator>, __iter_val_t<_InputIterator>,
1670 _Compare, _Allocator>;
1672 template<
typename _Key,
typename _Tp,
typename _Compare = less<_Key>,
1673 typename _Allocator = allocator<pair<const _Key, _Tp>>,
1674 typename = _RequireNotAllocator<_Compare>,
1675 typename = _RequireAllocator<_Allocator>>
1676 map(initializer_list<pair<_Key, _Tp>>,
1677 _Compare = _Compare(), _Allocator = _Allocator())
1678 -> map<_Key, _Tp, _Compare, _Allocator>;
1680 template <
typename _InputIterator,
typename _Allocator,
1681 typename = _RequireInputIter<_InputIterator>,
1682 typename = _RequireAllocator<_Allocator>>
1683 map(_InputIterator, _InputIterator, _Allocator)
1684 -> map<__iter_key_t<_InputIterator>, __iter_val_t<_InputIterator>,
1685 less<__iter_key_t<_InputIterator>>, _Allocator>;
1687 template<
typename _Key,
typename _Tp,
typename _Allocator,
1688 typename = _RequireAllocator<_Allocator>>
1689 map(initializer_list<pair<_Key, _Tp>>, _Allocator)
1690 -> map<_Key, _Tp, less<_Key>, _Allocator>;
1692 #if __glibcxx_containers_ranges
1693 template<ranges::input_range _Rg,
1694 __not_allocator_like _Compare = less<__detail::__range_key_type<_Rg>>,
1695 __allocator_like _Alloc =
1697 map(from_range_t, _Rg&&, _Compare = _Compare(), _Alloc = _Alloc())
1698 -> map<__detail::__range_key_type<_Rg>,
1699 __detail::__range_mapped_type<_Rg>,
1702 template<ranges::input_range _Rg, __allocator_like _Alloc>
1703 map(from_range_t, _Rg&&, _Alloc)
1704 -> map<__detail::__range_key_type<_Rg>,
1705 __detail::__range_mapped_type<_Rg>,
1706 less<__detail::__range_key_type<_Rg>>,
1722 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
1726 {
return __x._M_t == __y._M_t; }
1728 #if __cpp_lib_three_way_comparison
1743 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
1744 inline __detail::__synth3way_t<pair<const _Key, _Tp>>
1745 operator<=>(
const map<_Key, _Tp, _Compare, _Alloc>& __x,
1746 const map<_Key, _Tp, _Compare, _Alloc>& __y)
1747 {
return __x._M_t <=> __y._M_t; }
1760 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
1762 operator<(
const map<_Key, _Tp, _Compare, _Alloc>& __x,
1763 const map<_Key, _Tp, _Compare, _Alloc>& __y)
1764 {
return __x._M_t < __y._M_t; }
1767 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
1769 operator!=(
const map<_Key, _Tp, _Compare, _Alloc>& __x,
1770 const map<_Key, _Tp, _Compare, _Alloc>& __y)
1771 {
return !(__x == __y); }
1774 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
1776 operator>(
const map<_Key, _Tp, _Compare, _Alloc>& __x,
1777 const map<_Key, _Tp, _Compare, _Alloc>& __y)
1778 {
return __y < __x; }
1781 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
1783 operator<=(
const map<_Key, _Tp, _Compare, _Alloc>& __x,
1784 const map<_Key, _Tp, _Compare, _Alloc>& __y)
1785 {
return !(__y < __x); }
1788 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
1790 operator>=(
const map<_Key, _Tp, _Compare, _Alloc>& __x,
1791 const map<_Key, _Tp, _Compare, _Alloc>& __y)
1792 {
return !(__x < __y); }
1796 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
1800 _GLIBCXX_NOEXCEPT_IF(noexcept(__x.
swap(__y)))
1803 _GLIBCXX_END_NAMESPACE_CONTAINER
1805 #ifdef __glibcxx_node_extract
1807 template<
typename _Key,
typename _Val,
typename _Cmp1,
typename _Alloc,
1810 _Rb_tree_merge_helper<_GLIBCXX_STD_C::map<_Key, _Val, _Cmp1, _Alloc>,
1814 friend class _GLIBCXX_STD_C::map<_Key, _Val, _Cmp1, _Alloc>;
1817 _S_get_tree(_GLIBCXX_STD_C::map<_Key, _Val, _Cmp2, _Alloc>& __map)
1818 {
return __map._M_t; }
1821 _S_get_tree(_GLIBCXX_STD_C::multimap<_Key, _Val, _Cmp2, _Alloc>& __map)
1822 {
return __map._M_t; }
1826 _GLIBCXX_END_NAMESPACE_VERSION
constexpr bool operator<=(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
constexpr bool operator>=(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
constexpr bool operator<(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
constexpr bool operator>(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
typename remove_reference< _Tp >::type remove_reference_t
Alias template for remove_reference.
constexpr piecewise_construct_t piecewise_construct
Tag for piecewise construction of std::pair objects.
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
constexpr tuple< _Elements &&... > forward_as_tuple(_Elements &&... __args) noexcept
Create a tuple of lvalue or rvalue references to the arguments.
ISO C++ entities toplevel namespace is std.
Primary class template, tuple.
is_nothrow_copy_constructible
Node handle type for maps.
Return type of insert(node_handle&&) on unique maps/sets.
Struct holding two objects of arbitrary type.
_T1 first
The first member.
constexpr void swap(pair &__p) noexcept(__and_< __is_nothrow_swappable< _T1 >, __is_nothrow_swappable< _T2 >>::value)
Swap the first members and then the second members.
A standard container made up of (key,value) pairs, which can be retrieved based on a key,...
iterator emplace_hint(const_iterator __pos, _Args &&... __args)
Attempts to build and insert a std::pair into the map.
const_iterator find(const key_type &__x) const
Tries to locate an element in a map.
map(_InputIterator __first, _InputIterator __last, const allocator_type &__a)
Allocator-extended range constructor.
map & operator=(const map &)=default
Map assignment operator.
auto count(const _Kt &__x) const -> decltype(_M_t._M_count_tr(__x))
Finds the number of elements with given key.
auto equal_range(const _Kt &__x) const -> decltype(pair< const_iterator, const_iterator >(_M_t._M_equal_range_tr(__x)))
Finds a subsequence matching given key.
bool empty() const noexcept
const_reverse_iterator rend() const noexcept
bool contains(const key_type &__x) const
Finds whether an element with the given key exists.
pair< iterator, bool > insert_or_assign(const key_type &__k, _Obj &&__obj)
Attempts to insert or assign a std::pair into the map.
map(const map &__m, const __type_identity_t< allocator_type > &__a)
Allocator-extended copy constructor.
map & operator=(map &&)=default
Move assignment operator.
value_compare value_comp() const
auto lower_bound(const _Kt &__x) const -> decltype(const_iterator(_M_t._M_lower_bound_tr(__x)))
Finds the beginning of a subsequence matching given key.
void insert(_InputIterator __first, _InputIterator __last)
Template function that attempts to insert a range of elements.
iterator upper_bound(const key_type &__x)
Finds the end of a subsequence matching given key.
map(initializer_list< value_type > __l, const _Compare &__comp=_Compare(), const allocator_type &__a=allocator_type())
Builds a map from an initializer_list.
insert_return_type insert(node_type &&__nh)
Re-insert an extracted node.
auto find(const _Kt &__x) -> decltype(_M_t._M_find_tr(__x))
Tries to locate an element in a map.
iterator try_emplace(const_iterator __hint, const key_type &__k, _Args &&... __args)
Attempts to build and insert a std::pair into the map.
std::pair< iterator, bool > insert(const value_type &__x)
Attempts to insert a std::pair into the map.
map(map &&)=default
Map move constructor.
size_type count(const key_type &__x) const
Finds the number of elements with given key.
const_reverse_iterator rbegin() const noexcept
mapped_type & operator[](const key_type &__k)
Subscript ( [] ) access to map data.
reverse_iterator rbegin() noexcept
iterator insert_or_assign(const_iterator __hint, const key_type &__k, _Obj &&__obj)
Attempts to insert or assign a std::pair into the map.
const_iterator end() const noexcept
const_iterator cend() const noexcept
iterator insert_or_assign(const_iterator __hint, key_type &&__k, _Obj &&__obj)
Attempts to insert or assign a std::pair into the map.
auto upper_bound(const _Kt &__x) -> decltype(iterator(_M_t._M_upper_bound_tr(__x)))
Finds the end of a subsequence matching given key.
key_compare key_comp() const
map(map &&__m, const __type_identity_t< allocator_type > &__a) noexcept(is_nothrow_copy_constructible< _Compare >::value &&_Alloc_traits::_S_always_equal())
Allocator-extended move constructor.
auto lower_bound(const _Kt &__x) -> decltype(iterator(_M_t._M_lower_bound_tr(__x)))
Finds the beginning of a subsequence matching given key.
std::pair< iterator, iterator > equal_range(const key_type &__x)
Finds a subsequence matching given key.
map(_InputIterator __first, _InputIterator __last)
Builds a map from a range.
const_reverse_iterator crbegin() const noexcept
void swap(map &__x) noexcept(/*conditional */)
Swaps data with another map.
size_type erase(const key_type &__x)
Erases elements according to the provided key.
iterator insert(const_iterator __hint, node_type &&__nh)
Re-insert an extracted node.
map(initializer_list< value_type > __l, const allocator_type &__a)
Allocator-extended initialier-list constructor.
pair< iterator, bool > try_emplace(const key_type &__k, _Args &&... __args)
Attempts to build and insert a std::pair into the map.
map(const map &)=default
Map copy constructor.
node_type extract(const_iterator __pos)
Extract a node.
__enable_if_t< is_constructible< value_type, _Pair >::value, iterator > insert(const_iterator __position, _Pair &&__x)
Attempts to insert a std::pair into the map.
std::pair< iterator, bool > insert(value_type &&__x)
Attempts to insert a std::pair into the map.
map(const allocator_type &__a)
Allocator-extended default constructor.
node_type extract(const key_type &__x)
Extract a node.
iterator insert(const_iterator __position, value_type &&__x)
Attempts to insert a std::pair into the map.
iterator insert(const_iterator __position, const value_type &__x)
Attempts to insert a std::pair into the map.
map(const _Compare &__comp, const allocator_type &__a=allocator_type())
Creates a map with no elements.
reverse_iterator rend() noexcept
iterator erase(const_iterator __first, const_iterator __last)
Erases a [first,last) range of elements from a map.
mapped_type & at(const key_type &__k)
Access to map data.
void insert(std::initializer_list< value_type > __list)
Attempts to insert a list of std::pairs into the map.
const_iterator lower_bound(const key_type &__x) const
Finds the beginning of a subsequence matching given key.
size_type size() const noexcept
auto upper_bound(const _Kt &__x) const -> decltype(const_iterator(_M_t._M_upper_bound_tr(__x)))
Finds the end of a subsequence matching given key.
iterator find(const key_type &__x)
Tries to locate an element in a map.
map & operator=(initializer_list< value_type > __l)
Map list assignment operator.
map(_InputIterator __first, _InputIterator __last, const _Compare &__comp, const allocator_type &__a=allocator_type())
Builds a map from a range.
iterator erase(const_iterator __position)
Erases an element from a map.
auto find(const _Kt &__x) const -> decltype(_M_t._M_find_tr(__x))
Tries to locate an element in a map.
auto contains(const _Kt &__x) const -> decltype(_M_t._M_find_tr(__x), void(), true)
Finds whether an element with the given key exists.
std::pair< const_iterator, const_iterator > equal_range(const key_type &__x) const
Finds a subsequence matching given key.
__enable_if_t< is_constructible< value_type, _Pair >::value, pair< iterator, bool > > insert(_Pair &&__x)
Attempts to insert a std::pair into the map.
iterator lower_bound(const key_type &__x)
Finds the beginning of a subsequence matching given key.
const_reverse_iterator crend() const noexcept
std::pair< iterator, bool > emplace(_Args &&... __args)
Attempts to build and insert a std::pair into the map.
allocator_type get_allocator() const noexcept
Get a copy of the memory allocation object.
_GLIBCXX_ABI_TAG_CXX11 iterator erase(iterator __position)
Erases an element from a map.
auto equal_range(const _Kt &__x) -> decltype(pair< iterator, iterator >(_M_t._M_equal_range_tr(__x)))
Finds a subsequence matching given key.
const_iterator cbegin() const noexcept
size_type max_size() const noexcept
const_iterator begin() const noexcept
iterator begin() noexcept
map()=default
Default constructor creates no elements.
const_iterator upper_bound(const key_type &__x) const
Finds the end of a subsequence matching given key.
Uniform interface to C++98 and C++11 allocators.