30 #ifndef _UNORDERED_MAP_H
31 #define _UNORDERED_MAP_H
33 namespace std _GLIBCXX_VISIBILITY(default)
35 _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
41 template<
typename _Key,
48 _Alloc, __detail::_Select1st,
58 template<
typename _Key,
65 _Alloc, __detail::_Select1st,
71 template<
class _Key,
class _Tp,
class _Hash,
class _Pred,
class _Alloc>
97 template<
class _Key,
class _Tp,
111 typedef typename _Hashtable::value_type value_type;
112 typedef typename _Hashtable::mapped_type mapped_type;
113 typedef typename _Hashtable::hasher hasher;
114 typedef typename _Hashtable::key_equal key_equal;
115 typedef typename _Hashtable::allocator_type allocator_type;
121 typedef typename _Hashtable::const_pointer const_pointer;
122 typedef typename _Hashtable::reference reference;
123 typedef typename _Hashtable::const_reference const_reference;
124 typedef typename _Hashtable::iterator iterator;
125 typedef typename _Hashtable::const_iterator const_iterator;
126 typedef typename _Hashtable::local_iterator local_iterator;
127 typedef typename _Hashtable::const_local_iterator const_local_iterator;
128 typedef typename _Hashtable::size_type size_type;
129 typedef typename _Hashtable::difference_type difference_type;
132 #if __cplusplus > 201402L
133 using node_type =
typename _Hashtable::node_type;
134 using insert_return_type =
typename _Hashtable::insert_return_type;
151 const hasher& __hf = hasher(),
152 const key_equal& __eql = key_equal(),
153 const allocator_type& __a = allocator_type())
154 : _M_h(__n, __hf, __eql, __a)
170 template<
typename _InputIterator>
173 const hasher& __hf = hasher(),
174 const key_equal& __eql = key_equal(),
175 const allocator_type& __a = allocator_type())
176 : _M_h(__first, __last, __n, __hf, __eql, __a)
200 const allocator_type& __a)
201 : _M_h(__umap._M_h, __a)
210 const allocator_type& __a)
211 : _M_h(
std::move(__umap._M_h), __a)
227 const hasher& __hf = hasher(),
228 const key_equal& __eql = key_equal(),
229 const allocator_type& __a = allocator_type())
230 : _M_h(__l, __n, __hf, __eql, __a)
238 const allocator_type& __a)
242 template<
typename _InputIterator>
245 const allocator_type& __a)
246 :
unordered_map(__first, __last, __n, hasher(), key_equal(), __a)
249 template<
typename _InputIterator>
251 size_type __n,
const hasher& __hf,
252 const allocator_type& __a)
253 :
unordered_map(__first, __last, __n, __hf, key_equal(), __a)
258 const allocator_type& __a)
263 size_type __n,
const hasher& __hf,
264 const allocator_type& __a)
297 {
return _M_h.get_allocator(); }
304 {
return _M_h.empty(); }
309 {
return _M_h.size(); }
314 {
return _M_h.max_size(); }
324 {
return _M_h.begin(); }
333 {
return _M_h.begin(); }
336 cbegin() const noexcept
337 {
return _M_h.begin(); }
346 {
return _M_h.end(); }
355 {
return _M_h.end(); }
358 cend() const noexcept
359 {
return _M_h.end(); }
384 template<
typename... _Args>
387 {
return _M_h.emplace(std::forward<_Args>(__args)...); }
415 template<
typename... _Args>
418 {
return _M_h.emplace_hint(__pos, std::forward<_Args>(__args)...); }
420 #if __cplusplus > 201402L
423 extract(const_iterator __pos)
425 __glibcxx_assert(__pos !=
end());
426 return _M_h.extract(__pos);
432 {
return _M_h.extract(__key); }
437 {
return _M_h._M_reinsert_node(std::move(__nh)); }
441 insert(const_iterator, node_type&& __nh)
442 {
return _M_h._M_reinsert_node(std::move(__nh)).position; }
444 #define __cpp_lib_unordered_map_try_emplace 201411
467 template <
typename... _Args>
469 try_emplace(
const key_type& __k, _Args&&... __args)
471 iterator __i =
find(__k);
475 std::forward_as_tuple(__k),
476 std::forward_as_tuple(
477 std::forward<_Args>(__args)...))
485 template <
typename... _Args>
487 try_emplace(
key_type&& __k, _Args&&... __args)
489 iterator __i =
find(__k);
493 std::forward_as_tuple(std::move(__k)),
494 std::forward_as_tuple(
495 std::forward<_Args>(__args)...))
530 template <
typename... _Args>
532 try_emplace(const_iterator __hint,
const key_type& __k,
535 iterator __i =
find(__k);
538 std::forward_as_tuple(__k),
539 std::forward_as_tuple(
540 std::forward<_Args>(__args)...));
545 template <
typename... _Args>
547 try_emplace(const_iterator __hint,
key_type&& __k, _Args&&... __args)
549 iterator __i =
find(__k);
552 std::forward_as_tuple(std::move(__k)),
553 std::forward_as_tuple(
554 std::forward<_Args>(__args)...));
579 {
return _M_h.insert(__x); }
585 {
return _M_h.insert(std::move(__x)); }
587 template<
typename _Pair,
typename =
typename
588 std::enable_if<std::is_constructible<value_type,
589 _Pair&&>::value>::type>
592 {
return _M_h.insert(std::forward<_Pair>(__x)); }
618 insert(const_iterator __hint,
const value_type& __x)
619 {
return _M_h.insert(__hint, __x); }
624 insert(const_iterator __hint, value_type&& __x)
625 {
return _M_h.insert(__hint, std::move(__x)); }
627 template<
typename _Pair,
typename =
typename
628 std::enable_if<std::is_constructible<value_type,
629 _Pair&&>::value>::type>
631 insert(const_iterator __hint, _Pair&& __x)
632 {
return _M_h.insert(__hint, std::forward<_Pair>(__x)); }
644 template<
typename _InputIterator>
646 insert(_InputIterator __first, _InputIterator __last)
647 { _M_h.insert(__first, __last); }
658 { _M_h.insert(__l); }
661 #if __cplusplus > 201402L
662 #define __cpp_lib_unordered_map_insertion 201411
683 template <
typename _Obj>
685 insert_or_assign(
const key_type& __k, _Obj&& __obj)
691 std::forward_as_tuple(__k),
692 std::forward_as_tuple(std::forward<_Obj>(__obj)))
696 (*__i).second = std::forward<_Obj>(__obj);
701 template <
typename _Obj>
703 insert_or_assign(
key_type&& __k, _Obj&& __obj)
705 iterator __i =
find(__k);
709 std::forward_as_tuple(std::move(__k)),
710 std::forward_as_tuple(std::forward<_Obj>(__obj)))
714 (*__i).second = std::forward<_Obj>(__obj);
744 template <
typename _Obj>
746 insert_or_assign(const_iterator __hint,
const key_type& __k,
749 iterator __i =
find(__k);
753 std::forward_as_tuple(__k),
754 std::forward_as_tuple(
755 std::forward<_Obj>(__obj)));
757 (*__i).second = std::forward<_Obj>(__obj);
762 template <
typename _Obj>
764 insert_or_assign(const_iterator __hint,
key_type&& __k, _Obj&& __obj)
766 iterator __i =
find(__k);
770 std::forward_as_tuple(std::move(__k)),
771 std::forward_as_tuple(
772 std::forward<_Obj>(__obj)));
774 (*__i).second = std::forward<_Obj>(__obj);
795 {
return _M_h.erase(__position); }
800 {
return _M_h.erase(__position); }
817 {
return _M_h.erase(__x); }
834 erase(const_iterator __first, const_iterator __last)
835 {
return _M_h.erase(__first, __last); }
859 noexcept( noexcept(_M_h.swap(__x._M_h)) )
860 { _M_h.swap(__x._M_h); }
862 #if __cplusplus > 201402L
863 template<
typename,
typename,
typename>
864 friend class _Hash_merge_helper;
866 template<
typename _H2,
typename _P2>
870 using _Merge_helper = _Hash_merge_helper<unordered_map, _H2, _P2>;
871 _M_h._M_merge_unique(_Merge_helper::_S_get_table(__source));
874 template<
typename _H2,
typename _P2>
876 merge(unordered_map<_Key, _Tp, _H2, _P2, _Alloc>&& __source)
879 template<
typename _H2,
typename _P2>
881 merge(unordered_multimap<_Key, _Tp, _H2, _P2, _Alloc>& __source)
883 using _Merge_helper = _Hash_merge_helper<unordered_map, _H2, _P2>;
884 _M_h._M_merge_unique(_Merge_helper::_S_get_table(__source));
887 template<
typename _H2,
typename _P2>
889 merge(unordered_multimap<_Key, _Tp, _H2, _P2, _Alloc>&& __source)
899 {
return _M_h.hash_function(); }
905 {
return _M_h.key_eq(); }
923 {
return _M_h.find(__x); }
927 {
return _M_h.find(__x); }
941 {
return _M_h.count(__x); }
954 {
return _M_h.equal_range(__x); }
958 {
return _M_h.equal_range(__x); }
976 {
return _M_h[__k]; }
980 {
return _M_h[std::move(__k)]; }
993 {
return _M_h.at(__k); }
997 {
return _M_h.at(__k); }
1005 {
return _M_h.bucket_count(); }
1010 {
return _M_h.max_bucket_count(); }
1018 bucket_size(size_type __n)
const
1019 {
return _M_h.bucket_size(__n); }
1027 bucket(
const key_type& __key)
const
1028 {
return _M_h.bucket(__key); }
1038 {
return _M_h.begin(__n); }
1047 const_local_iterator
1049 {
return _M_h.begin(__n); }
1051 const_local_iterator
1052 cbegin(size_type __n)
const
1053 {
return _M_h.cbegin(__n); }
1064 {
return _M_h.end(__n); }
1073 const_local_iterator
1075 {
return _M_h.end(__n); }
1077 const_local_iterator
1078 cend(size_type __n)
const
1079 {
return _M_h.cend(__n); }
1087 {
return _M_h.load_factor(); }
1093 {
return _M_h.max_load_factor(); }
1101 { _M_h.max_load_factor(__z); }
1112 { _M_h.rehash(__n); }
1123 { _M_h.reserve(__n); }
1125 template<
typename _Key1,
typename _Tp1,
typename _Hash1,
typename _Pred1,
1155 template<
class _Key,
class _Tp,
1156 class _Hash = hash<_Key>,
1169 typedef typename _Hashtable::value_type value_type;
1170 typedef typename _Hashtable::mapped_type mapped_type;
1171 typedef typename _Hashtable::hasher hasher;
1172 typedef typename _Hashtable::key_equal key_equal;
1173 typedef typename _Hashtable::allocator_type allocator_type;
1179 typedef typename _Hashtable::const_pointer const_pointer;
1180 typedef typename _Hashtable::reference reference;
1181 typedef typename _Hashtable::const_reference const_reference;
1182 typedef typename _Hashtable::iterator iterator;
1183 typedef typename _Hashtable::const_iterator const_iterator;
1184 typedef typename _Hashtable::local_iterator local_iterator;
1185 typedef typename _Hashtable::const_local_iterator const_local_iterator;
1186 typedef typename _Hashtable::size_type size_type;
1187 typedef typename _Hashtable::difference_type difference_type;
1190 #if __cplusplus > 201402L
1191 using node_type =
typename _Hashtable::node_type;
1208 const hasher& __hf = hasher(),
1209 const key_equal& __eql = key_equal(),
1210 const allocator_type& __a = allocator_type())
1211 : _M_h(__n, __hf, __eql, __a)
1227 template<
typename _InputIterator>
1230 const hasher& __hf = hasher(),
1231 const key_equal& __eql = key_equal(),
1232 const allocator_type& __a = allocator_type())
1233 : _M_h(__first, __last, __n, __hf, __eql, __a)
1257 const allocator_type& __a)
1258 : _M_h(__ummap._M_h, __a)
1267 const allocator_type& __a)
1268 : _M_h(
std::move(__ummap._M_h), __a)
1284 const hasher& __hf = hasher(),
1285 const key_equal& __eql = key_equal(),
1286 const allocator_type& __a = allocator_type())
1287 : _M_h(__l, __n, __hf, __eql, __a)
1295 const allocator_type& __a)
1299 template<
typename _InputIterator>
1302 const allocator_type& __a)
1306 template<
typename _InputIterator>
1308 size_type __n,
const hasher& __hf,
1309 const allocator_type& __a)
1315 const allocator_type& __a)
1320 size_type __n,
const hasher& __hf,
1321 const allocator_type& __a)
1354 {
return _M_h.get_allocator(); }
1361 {
return _M_h.empty(); }
1366 {
return _M_h.size(); }
1371 {
return _M_h.max_size(); }
1381 {
return _M_h.begin(); }
1390 {
return _M_h.begin(); }
1393 cbegin() const noexcept
1394 {
return _M_h.begin(); }
1403 {
return _M_h.end(); }
1412 {
return _M_h.end(); }
1415 cend() const noexcept
1416 {
return _M_h.end(); }
1436 template<
typename... _Args>
1439 {
return _M_h.emplace(std::forward<_Args>(__args)...); }
1463 template<
typename... _Args>
1466 {
return _M_h.emplace_hint(__pos, std::forward<_Args>(__args)...); }
1480 {
return _M_h.insert(__x); }
1484 {
return _M_h.insert(std::move(__x)); }
1486 template<
typename _Pair,
typename =
typename
1487 std::enable_if<std::is_constructible<value_type,
1488 _Pair&&>::value>::type>
1491 {
return _M_h.insert(std::forward<_Pair>(__x)); }
1515 insert(const_iterator __hint,
const value_type& __x)
1516 {
return _M_h.insert(__hint, __x); }
1521 insert(const_iterator __hint, value_type&& __x)
1522 {
return _M_h.insert(__hint, std::move(__x)); }
1524 template<
typename _Pair,
typename =
typename
1525 std::enable_if<std::is_constructible<value_type,
1526 _Pair&&>::value>::type>
1528 insert(const_iterator __hint, _Pair&& __x)
1529 {
return _M_h.insert(__hint, std::forward<_Pair>(__x)); }
1541 template<
typename _InputIterator>
1543 insert(_InputIterator __first, _InputIterator __last)
1544 { _M_h.insert(__first, __last); }
1556 { _M_h.insert(__l); }
1558 #if __cplusplus > 201402L
1561 extract(const_iterator __pos)
1563 __glibcxx_assert(__pos !=
end());
1564 return _M_h.extract(__pos);
1570 {
return _M_h.extract(__key); }
1575 {
return _M_h._M_reinsert_node_multi(cend(), std::move(__nh)); }
1579 insert(const_iterator __hint, node_type&& __nh)
1580 {
return _M_h._M_reinsert_node_multi(__hint, std::move(__nh)); }
1599 {
return _M_h.erase(__position); }
1604 {
return _M_h.erase(__position); }
1620 {
return _M_h.erase(__x); }
1638 erase(const_iterator __first, const_iterator __last)
1639 {
return _M_h.erase(__first, __last); }
1663 noexcept( noexcept(_M_h.swap(__x._M_h)) )
1664 { _M_h.swap(__x._M_h); }
1666 #if __cplusplus > 201402L
1667 template<
typename,
typename,
typename>
1668 friend class _Hash_merge_helper;
1670 template<
typename _H2,
typename _P2>
1675 = _Hash_merge_helper<unordered_multimap, _H2, _P2>;
1676 _M_h._M_merge_multi(_Merge_helper::_S_get_table(__source));
1679 template<
typename _H2,
typename _P2>
1681 merge(unordered_multimap<_Key, _Tp, _H2, _P2, _Alloc>&& __source)
1682 { merge(__source); }
1684 template<
typename _H2,
typename _P2>
1686 merge(unordered_map<_Key, _Tp, _H2, _P2, _Alloc>& __source)
1689 = _Hash_merge_helper<unordered_multimap, _H2, _P2>;
1690 _M_h._M_merge_multi(_Merge_helper::_S_get_table(__source));
1693 template<
typename _H2,
typename _P2>
1695 merge(unordered_map<_Key, _Tp, _H2, _P2, _Alloc>&& __source)
1696 { merge(__source); }
1705 {
return _M_h.hash_function(); }
1711 {
return _M_h.key_eq(); }
1729 {
return _M_h.find(__x); }
1733 {
return _M_h.find(__x); }
1743 {
return _M_h.count(__x); }
1754 {
return _M_h.equal_range(__x); }
1758 {
return _M_h.equal_range(__x); }
1766 {
return _M_h.bucket_count(); }
1771 {
return _M_h.max_bucket_count(); }
1779 bucket_size(size_type __n)
const
1780 {
return _M_h.bucket_size(__n); }
1788 bucket(
const key_type& __key)
const
1789 {
return _M_h.bucket(__key); }
1799 {
return _M_h.begin(__n); }
1808 const_local_iterator
1810 {
return _M_h.begin(__n); }
1812 const_local_iterator
1813 cbegin(size_type __n)
const
1814 {
return _M_h.cbegin(__n); }
1825 {
return _M_h.end(__n); }
1834 const_local_iterator
1836 {
return _M_h.end(__n); }
1838 const_local_iterator
1839 cend(size_type __n)
const
1840 {
return _M_h.cend(__n); }
1848 {
return _M_h.load_factor(); }
1854 {
return _M_h.max_load_factor(); }
1862 { _M_h.max_load_factor(__z); }
1873 { _M_h.rehash(__n); }
1884 { _M_h.reserve(__n); }
1886 template<
typename _Key1,
typename _Tp1,
typename _Hash1,
typename _Pred1,
1890 _Hash1, _Pred1, _Alloc1>&,
1892 _Hash1, _Pred1, _Alloc1>&);
1895 template<
class _Key,
class _Tp,
class _Hash,
class _Pred,
class _Alloc>
1897 swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
1898 unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
1899 noexcept(noexcept(__x.swap(__y)))
1902 template<
class _Key,
class _Tp,
class _Hash,
class _Pred,
class _Alloc>
1904 swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
1905 unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
1906 noexcept(noexcept(__x.swap(__y)))
1909 template<
class _Key,
class _Tp,
class _Hash,
class _Pred,
class _Alloc>
1911 operator==(
const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
1912 const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
1913 {
return __x._M_h._M_equal(__y._M_h); }
1915 template<
class _Key,
class _Tp,
class _Hash,
class _Pred,
class _Alloc>
1917 operator!=(
const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
1918 const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
1919 {
return !(__x == __y); }
1921 template<
class _Key,
class _Tp,
class _Hash,
class _Pred,
class _Alloc>
1923 operator==(
const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
1924 const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
1925 {
return __x._M_h._M_equal(__y._M_h); }
1927 template<
class _Key,
class _Tp,
class _Hash,
class _Pred,
class _Alloc>
1929 operator!=(
const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
1930 const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
1931 {
return !(__x == __y); }
1933 _GLIBCXX_END_NAMESPACE_CONTAINER
1935 #if __cplusplus > 201402L
1936 _GLIBCXX_BEGIN_NAMESPACE_VERSION
1938 template<
typename _Key,
typename _Val,
typename _Hash1,
typename _Eq1,
1939 typename _Alloc,
typename _Hash2,
typename _Eq2>
1940 struct _Hash_merge_helper<
1941 _GLIBCXX_STD_C::unordered_map<_Key, _Val, _Hash1, _Eq1, _Alloc>,
1945 template<
typename... _Tp>
1946 using unordered_map = _GLIBCXX_STD_C::unordered_map<_Tp...>;
1947 template<
typename... _Tp>
1948 using unordered_multimap = _GLIBCXX_STD_C::unordered_multimap<_Tp...>;
1950 friend unordered_map<_Key, _Val, _Hash1, _Eq1, _Alloc>;
1953 _S_get_table(unordered_map<_Key, _Val, _Hash2, _Eq2, _Alloc>& __map)
1954 {
return __map._M_h; }
1957 _S_get_table(unordered_multimap<_Key, _Val, _Hash2, _Eq2, _Alloc>& __map)
1958 {
return __map._M_h; }
1962 template<
typename _Key,
typename _Val,
typename _Hash1,
typename _Eq1,
1963 typename _Alloc,
typename _Hash2,
typename _Eq2>
1964 struct _Hash_merge_helper<
1965 _GLIBCXX_STD_C::unordered_multimap<_Key, _Val, _Hash1, _Eq1, _Alloc>,
1969 template<
typename... _Tp>
1970 using unordered_map = _GLIBCXX_STD_C::unordered_map<_Tp...>;
1971 template<
typename... _Tp>
1972 using unordered_multimap = _GLIBCXX_STD_C::unordered_multimap<_Tp...>;
1974 friend unordered_multimap<_Key, _Val, _Hash1, _Eq1, _Alloc>;
1977 _S_get_table(unordered_map<_Key, _Val, _Hash2, _Eq2, _Alloc>& __map)
1978 {
return __map._M_h; }
1981 _S_get_table(unordered_multimap<_Key, _Val, _Hash2, _Eq2, _Alloc>& __map)
1982 {
return __map._M_h; }
1984 _GLIBCXX_END_NAMESPACE_VERSION
constexpr _GLIBCXX17_INLINE piecewise_construct_t piecewise_construct
piecewise_construct
ISO C++ entities toplevel namespace is std.
constexpr auto cend(const _Container &__cont) noexcept(noexcept(std::end(__cont))) -> decltype(std::end(__cont))
Return an iterator pointing to one past the last element of the const container.
constexpr auto cbegin(const _Container &__cont) noexcept(noexcept(std::begin(__cont))) -> decltype(std::begin(__cont))
Return an iterator pointing to the first element of the const container.
Primary class template hash.
The standard allocator, as per [20.4].
Default range hashing function: use division to fold a large number into the range [0,...
Default ranged hash function H. In principle it should be a function object composed from objects of ...
Default value for rehash policy. Bucket size is (usually) the smallest prime that keeps the load fact...
One of the comparison functors.
Struct holding two objects of arbitrary type.
A standard container composed of equivalent keys (possibly containing multiple of each key value) tha...
float load_factor() const noexcept
Returns the average number of elements per bucket.
unordered_multimap & operator=(const unordered_multimap &)=default
Copy assignment operator.
const_iterator end() const noexcept
size_type erase(const key_type &__x)
Erases elements according to the provided key.
size_type bucket_count() const noexcept
Returns the number of buckets of the unordered_multimap.
size_type max_bucket_count() const noexcept
Returns the maximum number of buckets of the unordered_multimap.
unordered_multimap & operator=(initializer_list< value_type > __l)
Unordered_multimap list assignment operator.
iterator begin() noexcept
const_iterator begin() const noexcept
hasher hash_function() const
Returns the hash functor object with which the unordered_multimap was constructed.
key_equal key_eq() const
Returns the key comparison object with which the unordered_multimap 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.
void insert(_InputIterator __first, _InputIterator __last)
A template function that attempts to insert a range of 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.
iterator emplace(_Args &&... __args)
Attempts to build and insert a std::pair into the unordered_multimap.
std::pair< iterator, iterator > equal_range(const key_type &__x)
Finds a subsequence matching given key.
iterator erase(const_iterator __position)
Erases an element from an unordered_multimap.
local_iterator begin(size_type __n)
Returns a read/write iterator pointing to the first bucket element.
float max_load_factor() const noexcept
Returns a positive number that the unordered_multimap tries to keep the load factor less than or equa...
unordered_multimap()=default
Default constructor.
iterator insert(const value_type &__x)
Inserts a std::pair into the unordered_multimap.
void reserve(size_type __n)
Prepare the unordered_multimap for a specified number of elements.
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.
iterator find(const key_type &__x)
Tries to locate an element in an unordered_multimap.
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.
iterator erase(const_iterator __first, const_iterator __last)
Erases a [__first,__last) range of elements from 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.
_Hashtable::pointer pointer
Iterator-related typedefs.
const_local_iterator begin(size_type __n) const
Returns a read-only (constant) iterator pointing to the first bucket element.
unordered_multimap(unordered_multimap &&)=default
Move constructor.
unordered_multimap(const allocator_type &__a)
Creates an unordered_multimap with no elements.
void swap(unordered_multimap &__x) noexcept(noexcept(_M_h.swap(__x._M_h)))
Swaps data with another unordered_multimap.
void rehash(size_type __n)
May rehash the unordered_multimap.
unordered_multimap & operator=(unordered_multimap &&)=default
Move assignment operator.
void insert(initializer_list< value_type > __l)
Attempts to insert a list of elements into the unordered_multimap.
size_type max_size() const noexcept
Returns the maximum size of the unordered_multimap.
bool empty() const noexcept
Returns true if the unordered_multimap is empty.
_Hashtable::key_type key_type
Public typedefs.
iterator insert(const_iterator __hint, const value_type &__x)
Inserts a std::pair into the unordered_multimap.
size_type size() const noexcept
Returns the size of the unordered_multimap.
unordered_multimap(const unordered_multimap &)=default
Copy constructor.
iterator emplace_hint(const_iterator __pos, _Args &&... __args)
Attempts to build and insert a std::pair into the unordered_multimap.
allocator_type get_allocator() const noexcept
Returns the allocator object used by the unordered_multimap.
void max_load_factor(float __z)
Change the unordered_multimap maximum load factor.
A standard container composed of unique keys (containing at most one of each key value) that associat...
std::pair< iterator, bool > insert(const value_type &__x)
Attempts to insert a std::pair into the unordered_map.
void max_load_factor(float __z)
Change the unordered_map maximum load factor.
void insert(_InputIterator __first, _InputIterator __last)
A template function that attempts to insert a range of elements.
allocator_type get_allocator() const noexcept
Returns the allocator object used by the unordered_map.
void insert(initializer_list< value_type > __l)
Attempts to insert a list of elements into the unordered_map.
iterator erase(const_iterator __first, const_iterator __last)
Erases a [__first,__last) range of elements from an unordered_map.
mapped_type & operator[](const key_type &__k)
Subscript ( [] ) access to unordered_map data.
void reserve(size_type __n)
Prepare the unordered_map for a specified number of elements.
std::pair< iterator, iterator > equal_range(const key_type &__x)
Finds a subsequence matching given key.
iterator insert(const_iterator __hint, const value_type &__x)
Attempts to insert a std::pair into the unordered_map.
unordered_map & operator=(initializer_list< value_type > __l)
Unordered_map list assignment operator.
unordered_map(const unordered_map &)=default
Copy constructor.
size_type count(const key_type &__x) const
Finds the number of elements.
bool empty() const noexcept
Returns true if the unordered_map is empty.
size_type erase(const key_type &__x)
Erases elements according to the provided key.
unordered_map(unordered_map &&)=default
Move constructor.
const_local_iterator end(size_type __n) const
Returns a read-only (constant) iterator pointing to one past the last bucket elements.
size_type max_size() const noexcept
Returns the maximum size of the unordered_map.
const_iterator end() const noexcept
unordered_map()=default
Default constructor.
const_local_iterator begin(size_type __n) const
Returns a read-only (constant) iterator pointing to the first bucket element.
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.
size_type size() const noexcept
Returns the size of the unordered_map.
unordered_map & operator=(unordered_map &&)=default
Move assignment operator.
mapped_type & at(const key_type &__k)
Access to unordered_map data.
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.
const_iterator begin() const noexcept
std::pair< iterator, bool > emplace(_Args &&... __args)
Attempts to build and insert a std::pair into the unordered_map.
key_equal key_eq() const
Returns the key comparison object with which the unordered_map was constructed.
local_iterator end(size_type __n)
Returns a read/write iterator pointing to one past the last bucket elements.
_Hashtable::pointer pointer
Iterator-related typedefs.
unordered_map(const allocator_type &__a)
Creates an unordered_map with no elements.
_Hashtable::key_type key_type
Public typedefs.
size_type bucket_count() const noexcept
Returns the number of buckets of the unordered_map.
iterator begin() noexcept
hasher hash_function() const
Returns the hash functor object with which the unordered_map was constructed.
unordered_map & operator=(const unordered_map &)=default
Copy assignment operator.
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_map.
float load_factor() const noexcept
Returns the average number of elements per bucket.
iterator erase(const_iterator __position)
Erases an element from an unordered_map.
void swap(unordered_map &__x) noexcept(noexcept(_M_h.swap(__x._M_h)))
Swaps data with another unordered_map.
local_iterator begin(size_type __n)
Returns a read/write iterator pointing to the first bucket element.
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.
size_type max_bucket_count() const noexcept
Returns the maximum number of buckets of the unordered_map.
iterator emplace_hint(const_iterator __pos, _Args &&... __args)
Attempts to build and insert a std::pair into the unordered_map.
void rehash(size_type __n)
May rehash the unordered_map.