30 #ifndef _UNORDERED_MAP_H 31 #define _UNORDERED_MAP_H 33 namespace std _GLIBCXX_VISIBILITY(default)
35 _GLIBCXX_BEGIN_NAMESPACE_VERSION
36 _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
42 template<
typename _Key,
49 _Alloc, __detail::_Select1st,
59 template<
typename _Key,
66 _Alloc, __detail::_Select1st,
72 template<
class _Key,
class _Tp,
class _Hash,
class _Pred,
class _Alloc>
98 template<
typename _Key,
typename _Tp,
114 typedef typename _Hashtable::hasher
hasher;
133 #if __cplusplus > 201402L 134 using node_type =
typename _Hashtable::node_type;
135 using insert_return_type =
typename _Hashtable::insert_return_type;
155 : _M_h(__n, __hf, __eql, __a)
171 template<
typename _InputIterator>
177 : _M_h(__first, __last, __n, __hf, __eql, __a)
202 : _M_h(__umap._M_h, __a)
212 : _M_h(
std::move(__umap._M_h), __a)
231 : _M_h(__l, __n, __hf, __eql, __a)
243 template<
typename _InputIterator>
250 template<
typename _InputIterator>
298 {
return _M_h.get_allocator(); }
305 {
return _M_h.empty(); }
310 {
return _M_h.size(); }
315 {
return _M_h.max_size(); }
325 {
return _M_h.begin(); }
334 {
return _M_h.begin(); }
338 {
return _M_h.begin(); }
347 {
return _M_h.end(); }
356 {
return _M_h.end(); }
360 {
return _M_h.end(); }
385 template<
typename... _Args>
388 {
return _M_h.emplace(std::forward<_Args>(__args)...); }
416 template<
typename... _Args>
419 {
return _M_h.emplace_hint(__pos, std::forward<_Args>(__args)...); }
421 #if __cplusplus > 201402L 426 __glibcxx_assert(__pos !=
end());
427 return _M_h.extract(__pos);
433 {
return _M_h.extract(__key); }
438 {
return _M_h._M_reinsert_node(std::move(__nh)); }
443 {
return _M_h._M_reinsert_node(std::move(__nh)).position; }
445 #define __cpp_lib_unordered_map_try_emplace 201411 468 template <
typename... _Args>
470 try_emplace(
const key_type& __k, _Args&&... __args)
476 std::forward_as_tuple(__k),
477 std::forward_as_tuple(
478 std::forward<_Args>(__args)...))
486 template <
typename... _Args>
488 try_emplace(
key_type&& __k, _Args&&... __args)
494 std::forward_as_tuple(std::move(__k)),
495 std::forward_as_tuple(
496 std::forward<_Args>(__args)...))
531 template <
typename... _Args>
539 std::forward_as_tuple(__k),
540 std::forward_as_tuple(
541 std::forward<_Args>(__args)...));
546 template <
typename... _Args>
553 std::forward_as_tuple(std::move(__k)),
554 std::forward_as_tuple(
555 std::forward<_Args>(__args)...));
580 {
return _M_h.insert(__x); }
586 {
return _M_h.insert(std::move(__x)); }
588 template<
typename _Pair,
typename =
typename 590 _Pair&&>::value>::type>
593 {
return _M_h.insert(std::forward<_Pair>(__x)); }
620 {
return _M_h.insert(__hint, __x); }
626 {
return _M_h.insert(__hint, std::move(__x)); }
628 template<
typename _Pair,
typename =
typename 630 _Pair&&>::value>::type>
633 {
return _M_h.insert(__hint, std::forward<_Pair>(__x)); }
645 template<
typename _InputIterator>
647 insert(_InputIterator __first, _InputIterator __last)
648 { _M_h.insert(__first, __last); }
659 { _M_h.insert(__l); }
662 #if __cplusplus > 201402L 663 #define __cpp_lib_unordered_map_insertion 201411 684 template <
typename _Obj>
686 insert_or_assign(
const key_type& __k, _Obj&& __obj)
692 std::forward_as_tuple(__k),
693 std::forward_as_tuple(std::forward<_Obj>(__obj)))
697 (*__i).second = std::forward<_Obj>(__obj);
702 template <
typename _Obj>
704 insert_or_assign(
key_type&& __k, _Obj&& __obj)
710 std::forward_as_tuple(std::move(__k)),
711 std::forward_as_tuple(std::forward<_Obj>(__obj)))
715 (*__i).second = std::forward<_Obj>(__obj);
745 template <
typename _Obj>
754 std::forward_as_tuple(__k),
755 std::forward_as_tuple(
756 std::forward<_Obj>(__obj)));
758 (*__i).second = std::forward<_Obj>(__obj);
763 template <
typename _Obj>
771 std::forward_as_tuple(std::move(__k)),
772 std::forward_as_tuple(
773 std::forward<_Obj>(__obj)));
775 (*__i).second = std::forward<_Obj>(__obj);
796 {
return _M_h.erase(__position); }
801 {
return _M_h.erase(__position); }
818 {
return _M_h.erase(__x); }
836 {
return _M_h.erase(__first, __last); }
860 noexcept( noexcept(_M_h.swap(__x._M_h)) )
861 { _M_h.swap(__x._M_h); }
863 #if __cplusplus > 201402L 864 template<
typename,
typename,
typename>
865 friend class std::_Hash_merge_helper;
867 template<
typename _H2,
typename _P2>
871 using _Merge_helper = _Hash_merge_helper<unordered_map, _H2, _P2>;
872 _M_h._M_merge_unique(_Merge_helper::_S_get_table(__source));
875 template<
typename _H2,
typename _P2>
877 merge(unordered_map<_Key, _Tp, _H2, _P2, _Alloc>&& __source)
880 template<
typename _H2,
typename _P2>
882 merge(unordered_multimap<_Key, _Tp, _H2, _P2, _Alloc>& __source)
884 using _Merge_helper = _Hash_merge_helper<unordered_map, _H2, _P2>;
885 _M_h._M_merge_unique(_Merge_helper::_S_get_table(__source));
888 template<
typename _H2,
typename _P2>
890 merge(unordered_multimap<_Key, _Tp, _H2, _P2, _Alloc>&& __source)
900 {
return _M_h.hash_function(); }
906 {
return _M_h.key_eq(); }
924 {
return _M_h.find(__x); }
928 {
return _M_h.find(__x); }
942 {
return _M_h.count(__x); }
955 {
return _M_h.equal_range(__x); }
959 {
return _M_h.equal_range(__x); }
977 {
return _M_h[__k]; }
981 {
return _M_h[std::move(__k)]; }
994 {
return _M_h.at(__k); }
998 {
return _M_h.at(__k); }
1006 {
return _M_h.bucket_count(); }
1011 {
return _M_h.max_bucket_count(); }
1020 {
return _M_h.bucket_size(__n); }
1028 bucket(
const key_type& __key)
const 1029 {
return _M_h.bucket(__key); }
1039 {
return _M_h.begin(__n); }
1050 {
return _M_h.begin(__n); }
1054 {
return _M_h.cbegin(__n); }
1065 {
return _M_h.end(__n); }
1076 {
return _M_h.end(__n); }
1080 {
return _M_h.cend(__n); }
1088 {
return _M_h.load_factor(); }
1094 {
return _M_h.max_load_factor(); }
1102 { _M_h.max_load_factor(__z); }
1113 { _M_h.rehash(__n); }
1124 { _M_h.reserve(__n); }
1126 template<
typename _Key1,
typename _Tp1,
typename _Hash1,
typename _Pred1,
1133 #if __cpp_deduction_guides >= 201606 1135 template<
typename _InputIterator,
1136 typename _Hash = hash<__iter_key_t<_InputIterator>>,
1137 typename _Pred = equal_to<__iter_key_t<_InputIterator>>,
1138 typename _Allocator = allocator<__iter_to_alloc_t<_InputIterator>>,
1139 typename = _RequireInputIter<_InputIterator>,
1140 typename = _RequireAllocator<_Allocator>>
1141 unordered_map(_InputIterator, _InputIterator,
1143 _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
1144 -> unordered_map<__iter_key_t<_InputIterator>,
1145 __iter_val_t<_InputIterator>,
1146 _Hash, _Pred, _Allocator>;
1148 template<
typename _Key,
typename _Tp,
typename _Hash = hash<_Key>,
1149 typename _Pred = equal_to<_Key>,
1150 typename _Allocator = allocator<pair<const _Key, _Tp>>,
1151 typename = _RequireAllocator<_Allocator>>
1152 unordered_map(initializer_list<pair<_Key, _Tp>>,
1154 _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
1155 -> unordered_map<_Key, _Tp, _Hash, _Pred, _Allocator>;
1157 template<
typename _InputIterator,
typename _Allocator,
1158 typename = _RequireInputIter<_InputIterator>,
1159 typename = _RequireAllocator<_Allocator>>
1160 unordered_map(_InputIterator, _InputIterator,
1162 -> unordered_map<__iter_key_t<_InputIterator>,
1163 __iter_val_t<_InputIterator>,
1164 hash<__iter_key_t<_InputIterator>>,
1165 equal_to<__iter_key_t<_InputIterator>>,
1168 template<
typename _InputIterator,
typename _Allocator,
1169 typename = _RequireInputIter<_InputIterator>,
1170 typename = _RequireAllocator<_Allocator>>
1171 unordered_map(_InputIterator, _InputIterator, _Allocator)
1172 -> unordered_map<__iter_key_t<_InputIterator>,
1173 __iter_val_t<_InputIterator>,
1174 hash<__iter_key_t<_InputIterator>>,
1175 equal_to<__iter_key_t<_InputIterator>>,
1178 template<
typename _InputIterator,
typename _Hash,
typename _Allocator,
1179 typename = _RequireInputIter<_InputIterator>,
1180 typename = _RequireAllocator<_Allocator>>
1181 unordered_map(_InputIterator, _InputIterator,
1184 -> unordered_map<__iter_key_t<_InputIterator>,
1185 __iter_val_t<_InputIterator>, _Hash,
1186 equal_to<__iter_key_t<_InputIterator>>, _Allocator>;
1188 template<
typename _Key,
typename _Tp,
typename _Allocator,
1189 typename = _RequireAllocator<_Allocator>>
1190 unordered_map(initializer_list<pair<_Key, _Tp>>,
1193 -> unordered_map<_Key, _Tp, hash<_Key>, equal_to<_Key>, _Allocator>;
1195 template<
typename _Key,
typename _Tp,
typename _Allocator,
1196 typename = _RequireAllocator<_Allocator>>
1197 unordered_map(initializer_list<pair<_Key, _Tp>>, _Allocator)
1198 -> unordered_map<_Key, _Tp, hash<_Key>, equal_to<_Key>, _Allocator>;
1200 template<
typename _Key,
typename _Tp,
typename _Hash,
typename _Allocator,
1201 typename = _RequireAllocator<_Allocator>>
1202 unordered_map(initializer_list<pair<_Key, _Tp>>,
1205 -> unordered_map<_Key, _Tp, _Hash, equal_to<_Key>, _Allocator>;
1232 template<
typename _Key,
typename _Tp,
1233 typename _Hash = hash<_Key>,
1234 typename _Pred = equal_to<_Key>,
1235 typename _Alloc = allocator<std::pair<const _Key, _Tp>>>
1236 class unordered_multimap
1238 typedef __ummap_hashtable<_Key, _Tp, _Hash, _Pred, _Alloc> _Hashtable;
1267 #if __cplusplus > 201402L 1268 using node_type =
typename _Hashtable::node_type;
1288 : _M_h(__n, __hf, __eql, __a)
1304 template<
typename _InputIterator>
1310 : _M_h(__first, __last, __n, __hf, __eql, __a)
1335 : _M_h(__ummap._M_h, __a)
1345 : _M_h(
std::move(__ummap._M_h), __a)
1364 : _M_h(__l, __n, __hf, __eql, __a)
1376 template<
typename _InputIterator>
1383 template<
typename _InputIterator>
1431 {
return _M_h.get_allocator(); }
1438 {
return _M_h.empty(); }
1443 {
return _M_h.size(); }
1448 {
return _M_h.max_size(); }
1458 {
return _M_h.begin(); }
1467 {
return _M_h.begin(); }
1471 {
return _M_h.begin(); }
1480 {
return _M_h.end(); }
1489 {
return _M_h.end(); }
1493 {
return _M_h.end(); }
1513 template<
typename... _Args>
1516 {
return _M_h.emplace(std::forward<_Args>(__args)...); }
1540 template<
typename... _Args>
1543 {
return _M_h.emplace_hint(__pos, std::forward<_Args>(__args)...); }
1557 {
return _M_h.insert(__x); }
1561 {
return _M_h.insert(std::move(__x)); }
1563 template<
typename _Pair,
typename =
typename 1565 _Pair&&>::value>::type>
1568 {
return _M_h.insert(std::forward<_Pair>(__x)); }
1593 {
return _M_h.insert(__hint, __x); }
1599 {
return _M_h.insert(__hint, std::move(__x)); }
1601 template<
typename _Pair,
typename =
typename 1603 _Pair&&>::value>::type>
1606 {
return _M_h.insert(__hint, std::forward<_Pair>(__x)); }
1618 template<
typename _InputIterator>
1620 insert(_InputIterator __first, _InputIterator __last)
1621 { _M_h.insert(__first, __last); }
1633 { _M_h.insert(__l); }
1635 #if __cplusplus > 201402L 1640 __glibcxx_assert(__pos !=
end());
1641 return _M_h.extract(__pos);
1647 {
return _M_h.extract(__key); }
1652 {
return _M_h._M_reinsert_node_multi(
cend(), std::move(__nh)); }
1657 {
return _M_h._M_reinsert_node_multi(__hint, std::move(__nh)); }
1676 {
return _M_h.erase(__position); }
1681 {
return _M_h.erase(__position); }
1697 {
return _M_h.erase(__x); }
1716 {
return _M_h.erase(__first, __last); }
1740 noexcept( noexcept(_M_h.swap(__x._M_h)) )
1741 { _M_h.swap(__x._M_h); }
1743 #if __cplusplus > 201402L 1744 template<
typename,
typename,
typename>
1745 friend class std::_Hash_merge_helper;
1747 template<
typename _H2,
typename _P2>
1752 = _Hash_merge_helper<unordered_multimap, _H2, _P2>;
1753 _M_h._M_merge_multi(_Merge_helper::_S_get_table(__source));
1756 template<
typename _H2,
typename _P2>
1758 merge(unordered_multimap<_Key, _Tp, _H2, _P2, _Alloc>&& __source)
1759 { merge(__source); }
1761 template<
typename _H2,
typename _P2>
1763 merge(unordered_map<_Key, _Tp, _H2, _P2, _Alloc>& __source)
1766 = _Hash_merge_helper<unordered_multimap, _H2, _P2>;
1767 _M_h._M_merge_multi(_Merge_helper::_S_get_table(__source));
1770 template<
typename _H2,
typename _P2>
1772 merge(unordered_map<_Key, _Tp, _H2, _P2, _Alloc>&& __source)
1773 { merge(__source); }
1782 {
return _M_h.hash_function(); }
1788 {
return _M_h.key_eq(); }
1806 {
return _M_h.find(__x); }
1810 {
return _M_h.find(__x); }
1820 {
return _M_h.count(__x); }
1831 {
return _M_h.equal_range(__x); }
1835 {
return _M_h.equal_range(__x); }
1843 {
return _M_h.bucket_count(); }
1848 {
return _M_h.max_bucket_count(); }
1857 {
return _M_h.bucket_size(__n); }
1865 bucket(
const key_type& __key)
const 1866 {
return _M_h.bucket(__key); }
1876 {
return _M_h.begin(__n); }
1887 {
return _M_h.begin(__n); }
1891 {
return _M_h.cbegin(__n); }
1902 {
return _M_h.end(__n); }
1913 {
return _M_h.end(__n); }
1917 {
return _M_h.cend(__n); }
1925 {
return _M_h.load_factor(); }
1931 {
return _M_h.max_load_factor(); }
1939 { _M_h.max_load_factor(__z); }
1950 { _M_h.rehash(__n); }
1961 { _M_h.reserve(__n); }
1963 template<
typename _Key1,
typename _Tp1,
typename _Hash1,
typename _Pred1,
1967 _Hash1, _Pred1, _Alloc1>&,
1969 _Hash1, _Pred1, _Alloc1>&);
1972 #if __cpp_deduction_guides >= 201606 1974 template<
typename _InputIterator,
1975 typename _Hash = hash<__iter_key_t<_InputIterator>>,
1976 typename _Pred = equal_to<__iter_key_t<_InputIterator>>,
1977 typename _Allocator = allocator<__iter_to_alloc_t<_InputIterator>>,
1978 typename = _RequireInputIter<_InputIterator>,
1979 typename = _RequireAllocator<_Allocator>>
1980 unordered_multimap(_InputIterator, _InputIterator,
1982 _Hash = _Hash(), _Pred = _Pred(),
1983 _Allocator = _Allocator())
1984 -> unordered_multimap<__iter_key_t<_InputIterator>,
1985 __iter_val_t<_InputIterator>, _Hash, _Pred,
1988 template<
typename _Key,
typename _Tp,
typename _Hash = hash<_Key>,
1989 typename _Pred = equal_to<_Key>,
1990 typename _Allocator = allocator<pair<const _Key, _Tp>>,
1991 typename = _RequireAllocator<_Allocator>>
1992 unordered_multimap(initializer_list<pair<_Key, _Tp>>,
1994 _Hash = _Hash(), _Pred = _Pred(),
1995 _Allocator = _Allocator())
1996 -> unordered_multimap<_Key, _Tp, _Hash, _Pred, _Allocator>;
1998 template<
typename _InputIterator,
typename _Allocator,
1999 typename = _RequireInputIter<_InputIterator>,
2000 typename = _RequireAllocator<_Allocator>>
2001 unordered_multimap(_InputIterator, _InputIterator,
2003 -> unordered_multimap<__iter_key_t<_InputIterator>,
2004 __iter_val_t<_InputIterator>,
2005 hash<__iter_key_t<_InputIterator>>,
2006 equal_to<__iter_key_t<_InputIterator>>, _Allocator>;
2008 template<
typename _InputIterator,
typename _Allocator,
2009 typename = _RequireInputIter<_InputIterator>,
2010 typename = _RequireAllocator<_Allocator>>
2011 unordered_multimap(_InputIterator, _InputIterator, _Allocator)
2012 -> unordered_multimap<__iter_key_t<_InputIterator>,
2013 __iter_val_t<_InputIterator>,
2014 hash<__iter_key_t<_InputIterator>>,
2015 equal_to<__iter_key_t<_InputIterator>>, _Allocator>;
2017 template<
typename _InputIterator,
typename _Hash,
typename _Allocator,
2018 typename = _RequireInputIter<_InputIterator>,
2019 typename = _RequireAllocator<_Allocator>>
2020 unordered_multimap(_InputIterator, _InputIterator,
2023 -> unordered_multimap<__iter_key_t<_InputIterator>,
2024 __iter_val_t<_InputIterator>, _Hash,
2025 equal_to<__iter_key_t<_InputIterator>>, _Allocator>;
2027 template<
typename _Key,
typename _Tp,
typename _Allocator,
2028 typename = _RequireAllocator<_Allocator>>
2029 unordered_multimap(initializer_list<pair<_Key, _Tp>>,
2032 -> unordered_multimap<_Key, _Tp, hash<_Key>, equal_to<_Key>, _Allocator>;
2034 template<
typename _Key,
typename _Tp,
typename _Allocator,
2035 typename = _RequireAllocator<_Allocator>>
2036 unordered_multimap(initializer_list<pair<_Key, _Tp>>, _Allocator)
2037 -> unordered_multimap<_Key, _Tp, hash<_Key>, equal_to<_Key>, _Allocator>;
2039 template<
typename _Key,
typename _Tp,
typename _Hash,
typename _Allocator,
2040 typename = _RequireAllocator<_Allocator>>
2041 unordered_multimap(initializer_list<pair<_Key, _Tp>>,
2044 -> unordered_multimap<_Key, _Tp, _Hash, equal_to<_Key>, _Allocator>;
2048 template<
class _Key,
class _Tp,
class _Hash,
class _Pred,
class _Alloc>
2050 swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
2051 unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
2052 noexcept(noexcept(__x.swap(__y)))
2055 template<
class _Key,
class _Tp,
class _Hash,
class _Pred,
class _Alloc>
2057 swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
2058 unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
2059 noexcept(noexcept(__x.swap(__y)))
2062 template<
class _Key,
class _Tp,
class _Hash,
class _Pred,
class _Alloc>
2064 operator==(
const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
2065 const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
2066 {
return __x._M_h._M_equal(__y._M_h); }
2068 template<
class _Key,
class _Tp,
class _Hash,
class _Pred,
class _Alloc>
2070 operator!=(
const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
2071 const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
2072 {
return !(__x == __y); }
2074 template<
class _Key,
class _Tp,
class _Hash,
class _Pred,
class _Alloc>
2076 operator==(
const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
2077 const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
2078 {
return __x._M_h._M_equal(__y._M_h); }
2080 template<
class _Key,
class _Tp,
class _Hash,
class _Pred,
class _Alloc>
2082 operator!=(
const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
2083 const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
2084 {
return !(__x == __y); }
2086 _GLIBCXX_END_NAMESPACE_CONTAINER
2088 #if __cplusplus > 201402L 2090 template<
typename _Key,
typename _Val,
typename _Hash1,
typename _Eq1,
2091 typename _Alloc,
typename _Hash2,
typename _Eq2>
2092 struct _Hash_merge_helper<
2093 _GLIBCXX_STD_C::unordered_map<_Key, _Val, _Hash1, _Eq1, _Alloc>,
2097 template<
typename... _Tp>
2098 using unordered_map = _GLIBCXX_STD_C::unordered_map<_Tp...>;
2099 template<
typename... _Tp>
2100 using unordered_multimap = _GLIBCXX_STD_C::unordered_multimap<_Tp...>;
2102 friend unordered_map<_Key, _Val, _Hash1, _Eq1, _Alloc>;
2105 _S_get_table(unordered_map<_Key, _Val, _Hash2, _Eq2, _Alloc>& __map)
2106 {
return __map._M_h; }
2109 _S_get_table(unordered_multimap<_Key, _Val, _Hash2, _Eq2, _Alloc>& __map)
2110 {
return __map._M_h; }
2114 template<
typename _Key,
typename _Val,
typename _Hash1,
typename _Eq1,
2115 typename _Alloc,
typename _Hash2,
typename _Eq2>
2116 struct _Hash_merge_helper<
2117 _GLIBCXX_STD_C::unordered_multimap<_Key, _Val, _Hash1, _Eq1, _Alloc>,
2121 template<
typename... _Tp>
2122 using unordered_map = _GLIBCXX_STD_C::unordered_map<_Tp...>;
2123 template<
typename... _Tp>
2124 using unordered_multimap = _GLIBCXX_STD_C::unordered_multimap<_Tp...>;
2126 friend unordered_multimap<_Key, _Val, _Hash1, _Eq1, _Alloc>;
2129 _S_get_table(unordered_map<_Key, _Val, _Hash2, _Eq2, _Alloc>& __map)
2130 {
return __map._M_h; }
2133 _S_get_table(unordered_multimap<_Key, _Val, _Hash2, _Eq2, _Alloc>& __map)
2134 {
return __map._M_h; }
2138 _GLIBCXX_END_NAMESPACE_VERSION
float load_factor() const noexcept
Returns the average number of elements per bucket.
unordered_multimap & operator=(initializer_list< value_type > __l)
Unordered_multimap list assignment operator.
iterator insert(value_type &&__x)
Inserts a std::pair into the unordered_multimap.
_Hashtable::hasher hasher
Public typedefs.
bool empty() const noexcept
Returns true if the unordered_map is empty.
unordered_multimap(const allocator_type &__a)
Creates an unordered_multimap with no elements.
Default value for rehash policy. Bucket size is (usually) the smallest prime that keeps the load fact...
const_local_iterator begin(size_type __n) const
Returns a read-only (constant) iterator pointing to the first bucket element.
_Hashtable::key_type key_type
Public typedefs.
iterator erase(const_iterator __position)
Erases an element from an unordered_map.
_Hashtable::value_type value_type
Public typedefs.
const_iterator begin() const noexcept
iterator erase(iterator __position)
Erases an element from an unordered_map.
const_iterator cend() const noexcept
_Hashtable::allocator_type allocator_type
Public typedefs.
const_iterator find(const key_type &__x) const
Tries to locate an element in an unordered_map.
void reserve(size_type __n)
Prepare the unordered_map for a specified number of elements.
A standard container composed of equivalent keys (possibly containing multiple of each key value) tha...
local_iterator begin(size_type __n)
Returns a read/write iterator pointing to the first bucket element.
std::pair< iterator, bool > insert(value_type &&__x)
Attempts to insert a std::pair into the unordered_map.
void insert(_InputIterator __first, _InputIterator __last)
A template function that attempts to insert a range of elements.
_Hashtable::const_iterator const_iterator
Iterator-related typedefs.
_Hashtable::const_reference const_reference
Iterator-related typedefs.
Define a member typedef type only if a boolean constant is true.
_Hashtable::const_pointer const_pointer
Iterator-related typedefs.
_Hashtable::difference_type difference_type
Iterator-related typedefs.
unordered_multimap & operator=(const unordered_multimap &)=default
Copy assignment operator.
unordered_multimap(initializer_list< value_type > __l, size_type __n=0, const hasher &__hf=hasher(), const key_equal &__eql=key_equal(), const allocator_type &__a=allocator_type())
Builds an unordered_multimap from an initializer_list.
Primary class template hash.
const_local_iterator begin(size_type __n) const
Returns a read-only (constant) iterator pointing to the first bucket element.
_Hashtable::key_equal key_equal
Public typedefs.
const_iterator cbegin() const noexcept
_Hashtable::local_iterator local_iterator
Iterator-related typedefs.
iterator begin() noexcept
_Hashtable::pointer pointer
Iterator-related typedefs.
iterator insert(const_iterator __hint, const value_type &__x)
Attempts to insert a std::pair into the unordered_map.
size_type bucket_count() const noexcept
Returns the number of buckets of the unordered_map.
_Hashtable::size_type size_type
Iterator-related typedefs.
void swap(unordered_map &__x) noexcept(noexcept(_M_h.swap(__x._M_h)))
Swaps data with another unordered_map.
_Hashtable::reference reference
Iterator-related typedefs.
iterator erase(const_iterator __first, const_iterator __last)
Erases a [__first,__last) range of elements from an unordered_map.
iterator erase(const_iterator __first, const_iterator __last)
Erases a [__first,__last) range of elements from an unordered_multimap.
_Hashtable::const_pointer const_pointer
Iterator-related typedefs.
local_iterator begin(size_type __n)
Returns a read/write iterator pointing to the first bucket element.
bool empty() const noexcept
Returns true if the unordered_multimap is empty.
size_type max_bucket_count() const noexcept
Returns the maximum number of buckets of the unordered_map.
const_local_iterator cend(size_type __n) const
Returns a read-only (constant) iterator pointing to one past the last bucket elements.
std::pair< iterator, bool > insert(const value_type &__x)
Attempts to insert a std::pair into the unordered_map.
_Hashtable::mapped_type mapped_type
Public typedefs.
std::pair< iterator, bool > insert(_Pair &&__x)
Attempts to insert a std::pair into the unordered_map.
const_iterator begin() const noexcept
iterator emplace_hint(const_iterator __pos, _Args &&... __args)
Attempts to build and insert a std::pair into the unordered_map.
_Hashtable::hasher hasher
Public typedefs.
const_iterator end() const noexcept
key_equal key_eq() const
Returns the key comparison object with which the unordered_multimap was constructed.
std::pair< const_iterator, const_iterator > equal_range(const key_type &__x) const
Finds a subsequence matching given key.
key_equal key_eq() const
Returns the key comparison object with which the unordered_map was constructed.
mapped_type & at(const key_type &__k)
Access to unordered_map data.
const mapped_type & at(const key_type &__k) const
Access to unordered_map data.
_Hashtable::iterator iterator
Iterator-related typedefs.
unordered_map(const allocator_type &__a)
Creates an unordered_map with no elements.
void rehash(size_type __n)
May rehash the unordered_multimap.
iterator erase(const_iterator __position)
Erases an element from an unordered_multimap.
iterator find(const key_type &__x)
Tries to locate an element in an unordered_map.
iterator insert(const_iterator __hint, value_type &&__x)
Attempts to insert a std::pair into the unordered_map.
const_iterator cbegin() const noexcept
const_local_iterator end(size_type __n) const
Returns a read-only (constant) iterator pointing to one past the last bucket elements.
_Hashtable::value_type value_type
Public typedefs.
void reserve(size_type __n)
Prepare the unordered_multimap for a specified number of elements.
unordered_map(_InputIterator __first, _InputIterator __last, size_type __n=0, const hasher &__hf=hasher(), const key_equal &__eql=key_equal(), const allocator_type &__a=allocator_type())
Builds an unordered_map from a range.
unordered_multimap()=default
Default constructor.
allocator_type get_allocator() const noexcept
Returns the allocator object used by the unordered_multimap.
iterator insert(const_iterator __hint, _Pair &&__x)
Inserts a std::pair into the unordered_multimap.
iterator insert(_Pair &&__x)
Inserts a std::pair into the unordered_multimap.
_Hashtable::iterator iterator
Iterator-related typedefs.
iterator insert(const_iterator __hint, _Pair &&__x)
Attempts to insert a std::pair into the unordered_map.
_Hashtable::local_iterator local_iterator
Iterator-related typedefs.
iterator emplace(_Args &&... __args)
Attempts to build and insert a std::pair into the unordered_multimap.
std::pair< const_iterator, const_iterator > equal_range(const key_type &__x) const
Finds a subsequence matching given key.
size_type erase(const key_type &__x)
Erases elements according to the provided key.
_GLIBCXX17_INLINE constexpr piecewise_construct_t piecewise_construct
piecewise_construct
_Hashtable::mapped_type mapped_type
Public typedefs.
ISO C++ entities toplevel namespace is std.
One of the comparison functors.
void insert(_InputIterator __first, _InputIterator __last)
A template function that attempts to insert a range of elements.
_Hashtable::const_reference const_reference
Iterator-related typedefs.
_Hashtable::pointer pointer
Iterator-related typedefs.
_Hashtable::const_iterator const_iterator
Iterator-related typedefs.
size_type size() const noexcept
Returns the size of the unordered_map.
_Hashtable::const_local_iterator const_local_iterator
Iterator-related typedefs.
The standard allocator, as per [20.4].
size_type count(const key_type &__x) const
Finds the number of elements.
const_iterator cend() const noexcept
Default ranged hash function H. In principle it should be a function object composed from objects of ...
_Hashtable::size_type size_type
Iterator-related typedefs.
hasher hash_function() const
Returns the hash functor object with which the unordered_multimap was constructed.
mapped_type & operator[](const key_type &__k)
Subscript ( [] ) access to unordered_map data.
iterator insert(const_iterator __hint, value_type &&__x)
Inserts a std::pair into the unordered_multimap.
_Hashtable::key_equal key_equal
Public typedefs.
_Hashtable::const_local_iterator const_local_iterator
Iterator-related typedefs.
float max_load_factor() const noexcept
Returns a positive number that the unordered_map tries to keep the load factor less than or equal to...
const_iterator end() const noexcept
std::pair< iterator, iterator > equal_range(const key_type &__x)
Finds a subsequence matching given key.
std::pair< iterator, bool > emplace(_Args &&... __args)
Attempts to build and insert a std::pair into the unordered_map.
_Hashtable::difference_type difference_type
Iterator-related typedefs.
void insert(initializer_list< value_type > __l)
Attempts to insert a list of elements into the unordered_map.
mapped_type & operator[](key_type &&__k)
Subscript ( [] ) access to unordered_map data.
size_type max_size() const noexcept
Returns the maximum size of the unordered_map.
unordered_map(initializer_list< value_type > __l, size_type __n=0, const hasher &__hf=hasher(), const key_equal &__eql=key_equal(), const allocator_type &__a=allocator_type())
Builds an unordered_map from an initializer_list.
iterator find(const key_type &__x)
Tries to locate an element in an unordered_multimap.
void swap(unordered_multimap &__x) noexcept(noexcept(_M_h.swap(__x._M_h)))
Swaps data with another unordered_multimap.
void insert(initializer_list< value_type > __l)
Attempts to insert a list of elements into the unordered_multimap.
const_local_iterator cend(size_type __n) const
Returns a read-only (constant) iterator pointing to one past the last bucket elements.
iterator insert(const value_type &__x)
Inserts a std::pair into the unordered_multimap.
local_iterator end(size_type __n)
Returns a read/write iterator pointing to one past the last bucket elements.
size_type max_bucket_count() const noexcept
Returns the maximum number of buckets of the unordered_multimap.
_Hashtable::key_type key_type
Public typedefs.
iterator emplace_hint(const_iterator __pos, _Args &&... __args)
Attempts to build and insert a std::pair into the unordered_multimap.
void rehash(size_type __n)
May rehash the unordered_map.
unordered_multimap(_InputIterator __first, _InputIterator __last, size_type __n=0, const hasher &__hf=hasher(), const key_equal &__eql=key_equal(), const allocator_type &__a=allocator_type())
Builds an unordered_multimap from a range.
_Hashtable::allocator_type allocator_type
Public typedefs.
void max_load_factor(float __z)
Change the unordered_multimap maximum load factor.
Struct holding two objects of arbitrary type.
const_local_iterator cbegin(size_type __n) const
Returns a read-only (constant) iterator pointing to the first bucket element.
const_local_iterator cbegin(size_type __n) const
Returns a read-only (constant) iterator pointing to the first bucket element.
void max_load_factor(float __z)
Change the unordered_map maximum load factor.
size_type size() const noexcept
Returns the size of the unordered_multimap.
unordered_map & operator=(initializer_list< value_type > __l)
Unordered_map list assignment operator.
iterator insert(const_iterator __hint, const value_type &__x)
Inserts a std::pair into the unordered_multimap.
_Hashtable::reference reference
Iterator-related typedefs.
iterator begin() noexcept
std::pair< iterator, iterator > equal_range(const key_type &__x)
Finds a subsequence matching given key.
unordered_map()=default
Default constructor.
size_type bucket_count() const noexcept
Returns the number of buckets of the unordered_multimap.
size_type erase(const key_type &__x)
Erases elements according to the provided key.
iterator erase(iterator __position)
Erases an element from an unordered_multimap.
Default range hashing function: use division to fold a large number into the range [0...
unordered_map(size_type __n, const hasher &__hf=hasher(), const key_equal &__eql=key_equal(), const allocator_type &__a=allocator_type())
Default constructor creates no elements.
float max_load_factor() const noexcept
Returns a positive number that the unordered_multimap tries to keep the load factor less than or equa...
float load_factor() const noexcept
Returns the average number of elements per bucket.
size_type max_size() const noexcept
Returns the maximum size of the unordered_multimap.
A standard container composed of unique keys (containing at most one of each key value) that associat...
allocator_type get_allocator() const noexcept
Returns the allocator object used by the unordered_map.
hasher hash_function() const
Returns the hash functor object with which the unordered_map was constructed.
size_type count(const key_type &__x) const
Finds the number of elements.
local_iterator end(size_type __n)
Returns a read/write iterator pointing to one past the last bucket elements.
unordered_multimap(size_type __n, const hasher &__hf=hasher(), const key_equal &__eql=key_equal(), const allocator_type &__a=allocator_type())
Default constructor creates no elements.
const_iterator find(const key_type &__x) const
Tries to locate an element in an unordered_multimap.
const_local_iterator end(size_type __n) const
Returns a read-only (constant) iterator pointing to one past the last bucket elements.
unordered_map & operator=(const unordered_map &)=default
Copy assignment operator.