summaryrefslogtreecommitdiff
path: root/include/unordered_map
diff options
context:
space:
mode:
Diffstat (limited to 'include/unordered_map')
-rw-r--r--include/unordered_map97
1 files changed, 97 insertions, 0 deletions
diff --git a/include/unordered_map b/include/unordered_map
index fc3cfb6a9..6f60749c9 100644
--- a/include/unordered_map
+++ b/include/unordered_map
@@ -153,6 +153,15 @@ public:
iterator erase(const_iterator first, const_iterator last);
void clear() noexcept;
+ template<class H2, class P2>
+ void merge(unordered_map<Key, T, H2, P2, Allocator>& source); // C++17
+ template<class H2, class P2>
+ void merge(unordered_map<Key, T, H2, P2, Allocator>&& source); // C++17
+ template<class H2, class P2>
+ void merge(unordered_multimap<Key, T, H2, P2, Allocator>& source); // C++17
+ template<class H2, class P2>
+ void merge(unordered_multimap<Key, T, H2, P2, Allocator>&& source); // C++17
+
void swap(unordered_map&)
noexcept(
(!allocator_type::propagate_on_container_swap::value ||
@@ -325,6 +334,15 @@ public:
iterator erase(const_iterator first, const_iterator last);
void clear() noexcept;
+ template<class H2, class P2>
+ void merge(unordered_multimap<Key, T, H2, P2, Allocator>& source); // C++17
+ template<class H2, class P2>
+ void merge(unordered_multimap<Key, T, H2, P2, Allocator>&& source); // C++17
+ template<class H2, class P2>
+ void merge(unordered_map<Key, T, H2, P2, Allocator>& source); // C++17
+ template<class H2, class P2>
+ void merge(unordered_map<Key, T, H2, P2, Allocator>&& source); // C++17
+
void swap(unordered_multimap&)
noexcept(
(!allocator_type::propagate_on_container_swap::value ||
@@ -808,6 +826,9 @@ public:
template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator;
};
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+class unordered_multimap;
+
template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
class _Alloc = allocator<pair<const _Key, _Tp> > >
class _LIBCPP_TEMPLATE_VIS unordered_map
@@ -865,6 +886,11 @@ public:
typedef __insert_return_type<iterator, node_type> insert_return_type;
#endif
+ template <class _Key2, class _Tp2, class _Hash2, class _Pred2, class _Alloc2>
+ friend class _LIBCPP_TEMPLATE_VIS unordered_map;
+ template <class _Key2, class _Tp2, class _Hash2, class _Pred2, class _Alloc2>
+ friend class _LIBCPP_TEMPLATE_VIS unordered_multimap;
+
_LIBCPP_INLINE_VISIBILITY
unordered_map()
_NOEXCEPT_(is_nothrow_default_constructible<__table>::value)
@@ -1188,6 +1214,39 @@ public:
return __table_.template __node_handle_extract<node_type>(
__it.__i_);
}
+
+ template <class _H2, class _P2>
+ _LIBCPP_INLINE_VISIBILITY
+ void merge(unordered_map<key_type, mapped_type, _H2, _P2, allocator_type>& __source)
+ {
+ _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
+ "merging container with incompatible allocator");
+ return __table_.__node_handle_merge_unique(__source.__table_);
+ }
+ template <class _H2, class _P2>
+ _LIBCPP_INLINE_VISIBILITY
+ void merge(unordered_map<key_type, mapped_type, _H2, _P2, allocator_type>&& __source)
+ {
+ _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
+ "merging container with incompatible allocator");
+ return __table_.__node_handle_merge_unique(__source.__table_);
+ }
+ template <class _H2, class _P2>
+ _LIBCPP_INLINE_VISIBILITY
+ void merge(unordered_multimap<key_type, mapped_type, _H2, _P2, allocator_type>& __source)
+ {
+ _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
+ "merging container with incompatible allocator");
+ return __table_.__node_handle_merge_unique(__source.__table_);
+ }
+ template <class _H2, class _P2>
+ _LIBCPP_INLINE_VISIBILITY
+ void merge(unordered_multimap<key_type, mapped_type, _H2, _P2, allocator_type>&& __source)
+ {
+ _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
+ "merging container with incompatible allocator");
+ return __table_.__node_handle_merge_unique(__source.__table_);
+ }
#endif
_LIBCPP_INLINE_VISIBILITY
@@ -1646,6 +1705,11 @@ public:
typedef __map_node_handle<__node, allocator_type> node_type;
#endif
+ template <class _Key2, class _Tp2, class _Hash2, class _Pred2, class _Alloc2>
+ friend class _LIBCPP_TEMPLATE_VIS unordered_map;
+ template <class _Key2, class _Tp2, class _Hash2, class _Pred2, class _Alloc2>
+ friend class _LIBCPP_TEMPLATE_VIS unordered_multimap;
+
_LIBCPP_INLINE_VISIBILITY
unordered_multimap()
_NOEXCEPT_(is_nothrow_default_constructible<__table>::value)
@@ -1847,6 +1911,39 @@ public:
return __table_.template __node_handle_extract<node_type>(
__it.__i_);
}
+
+ template <class _H2, class _P2>
+ _LIBCPP_INLINE_VISIBILITY
+ void merge(unordered_multimap<key_type, mapped_type, _H2, _P2, allocator_type>& __source)
+ {
+ _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
+ "merging container with incompatible allocator");
+ return __table_.__node_handle_merge_multi(__source.__table_);
+ }
+ template <class _H2, class _P2>
+ _LIBCPP_INLINE_VISIBILITY
+ void merge(unordered_multimap<key_type, mapped_type, _H2, _P2, allocator_type>&& __source)
+ {
+ _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
+ "merging container with incompatible allocator");
+ return __table_.__node_handle_merge_multi(__source.__table_);
+ }
+ template <class _H2, class _P2>
+ _LIBCPP_INLINE_VISIBILITY
+ void merge(unordered_map<key_type, mapped_type, _H2, _P2, allocator_type>& __source)
+ {
+ _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
+ "merging container with incompatible allocator");
+ return __table_.__node_handle_merge_multi(__source.__table_);
+ }
+ template <class _H2, class _P2>
+ _LIBCPP_INLINE_VISIBILITY
+ void merge(unordered_map<key_type, mapped_type, _H2, _P2, allocator_type>&& __source)
+ {
+ _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
+ "merging container with incompatible allocator");
+ return __table_.__node_handle_merge_multi(__source.__table_);
+ }
#endif
_LIBCPP_INLINE_VISIBILITY