aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorville <ville@138bc75d-0d04-0410-961f-82ee72b054a4>2017-10-26 16:42:31 +0000
committerville <ville@138bc75d-0d04-0410-961f-82ee72b054a4>2017-10-26 16:42:31 +0000
commitaa9edc021f49a47c1e512a10df3b587b8182e5aa (patch)
tree7c2cad975d641075c6537cff8b686ab8238fe588
parent1848e944f787a609274ccdd890e8142f17a736d1 (diff)
Deduction guides for associative containers, debug mode deduction guide fixes.
* include/bits/stl_iterator.h (__iter_key_t) (__iter_val_t, __iter_to_alloc_t): New. * include/bits/stl_map.h: Add deduction guides. * include/bits/stl_multimap.h: Likewise. * include/bits/stl_multiset.h: Likewise. * include/bits/stl_set.h: Likewise. * include/bits/unordered_map.h: Likewise. * include/bits/unordered_set.h: Likewise. * include/debug/deque: Likewise. * include/debug/forward_list: Likewise. * include/debug/list: Likewise. * include/debug/map.h: Likewise. * include/debug/multimap.h: Likewise. * include/debug/multiset.h: Likewise. * include/debug/set.h: Likewise. * include/debug/unordered_map: Likewise. * include/debug/unordered_set: Likewise. * include/debug/vector: Likewise. * testsuite/23_containers/map/cons/deduction.cc: New. * testsuite/23_containers/multimap/cons/deduction.cc: Likewise. * testsuite/23_containers/multiset/cons/deduction.cc: Likewise. * testsuite/23_containers/set/cons/deduction.cc: Likewise. * testsuite/23_containers/unordered_map/cons/deduction.cc: Likewise. * testsuite/23_containers/unordered_multimap/cons/deduction.cc: Likewise. * testsuite/23_containers/unordered_multiset/cons/deduction.cc: Likewise. * testsuite/23_containers/unordered_set/cons/deduction.cc: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@254113 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libstdc++-v3/ChangeLog33
-rw-r--r--libstdc++-v3/include/bits/stl_iterator.h21
-rw-r--r--libstdc++-v3/include/bits/stl_map.h34
-rw-r--r--libstdc++-v3/include/bits/stl_multimap.h33
-rw-r--r--libstdc++-v3/include/bits/stl_multiset.h38
-rw-r--r--libstdc++-v3/include/bits/stl_set.h35
-rw-r--r--libstdc++-v3/include/bits/unordered_map.h152
-rw-r--r--libstdc++-v3/include/bits/unordered_set.h133
-rw-r--r--libstdc++-v3/include/debug/deque10
-rw-r--r--libstdc++-v3/include/debug/forward_list10
-rw-r--r--libstdc++-v3/include/debug/list10
-rw-r--r--libstdc++-v3/include/debug/map.h33
-rw-r--r--libstdc++-v3/include/debug/multimap.h33
-rw-r--r--libstdc++-v3/include/debug/multiset.h37
-rw-r--r--libstdc++-v3/include/debug/set.h36
-rw-r--r--libstdc++-v3/include/debug/unordered_map152
-rw-r--r--libstdc++-v3/include/debug/unordered_set132
-rw-r--r--libstdc++-v3/include/debug/vector10
-rw-r--r--libstdc++-v3/testsuite/23_containers/map/cons/deduction.cc68
-rw-r--r--libstdc++-v3/testsuite/23_containers/multimap/cons/deduction.cc68
-rw-r--r--libstdc++-v3/testsuite/23_containers/multiset/cons/deduction.cc68
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/cons/deduction.cc68
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/cons/deduction.cc77
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_multimap/cons/deduction.cc77
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/deduction.cc78
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_set/cons/deduction.cc78
26 files changed, 1524 insertions, 0 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 438b187346f..a4df5b6398c 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,36 @@
+2017-10-26 Ville Voutilainen <ville.voutilainen@gmail.com>
+
+ Deduction guides for associative containers, debug mode deduction
+ guide fixes.
+ * include/bits/stl_iterator.h (__iter_key_t)
+ (__iter_val_t, __iter_to_alloc_t): New.
+ * include/bits/stl_map.h: Add deduction guides.
+ * include/bits/stl_multimap.h: Likewise.
+ * include/bits/stl_multiset.h: Likewise.
+ * include/bits/stl_set.h: Likewise.
+ * include/bits/unordered_map.h: Likewise.
+ * include/bits/unordered_set.h: Likewise.
+ * include/debug/deque: Likewise.
+ * include/debug/forward_list: Likewise.
+ * include/debug/list: Likewise.
+ * include/debug/map.h: Likewise.
+ * include/debug/multimap.h: Likewise.
+ * include/debug/multiset.h: Likewise.
+ * include/debug/set.h: Likewise.
+ * include/debug/unordered_map: Likewise.
+ * include/debug/unordered_set: Likewise.
+ * include/debug/vector: Likewise.
+ * testsuite/23_containers/map/cons/deduction.cc: New.
+ * testsuite/23_containers/multimap/cons/deduction.cc: Likewise.
+ * testsuite/23_containers/multiset/cons/deduction.cc: Likewise.
+ * testsuite/23_containers/set/cons/deduction.cc: Likewise.
+ * testsuite/23_containers/unordered_map/cons/deduction.cc: Likewise.
+ * testsuite/23_containers/unordered_multimap/cons/deduction.cc:
+ Likewise.
+ * testsuite/23_containers/unordered_multiset/cons/deduction.cc:
+ Likewise.
+ * testsuite/23_containers/unordered_set/cons/deduction.cc: Likewise.
+
2017-10-25 Jonathan Wakely <jwakely@redhat.com>
* doc/xml/manual/status_cxx2017.xml: Update C++17 status, and
diff --git a/libstdc++-v3/include/bits/stl_iterator.h b/libstdc++-v3/include/bits/stl_iterator.h
index 88667a568c3..74ef0d9bf88 100644
--- a/libstdc++-v3/include/bits/stl_iterator.h
+++ b/libstdc++-v3/include/bits/stl_iterator.h
@@ -1244,6 +1244,27 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#define _GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(_Iter) (_Iter)
#endif // C++11
+#if __cpp_deduction_guides >= 201606
+ // These helper traits are used for deduction guides
+ // of associative containers.
+ template<typename _InputIterator>
+ using __iter_key_t = remove_const_t<
+ typename iterator_traits<_InputIterator>::value_type::first_type>;
+
+ template<typename _InputIterator>
+ using __iter_val_t =
+ typename iterator_traits<_InputIterator>::value_type::second_type;
+
+ template<typename _T1, typename _T2>
+ struct pair;
+
+ template<typename _InputIterator>
+ using __iter_to_alloc_t =
+ pair<add_const_t<__iter_key_t<_InputIterator>>,
+ __iter_val_t<_InputIterator>>;
+
+#endif
+
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
diff --git a/libstdc++-v3/include/bits/stl_map.h b/libstdc++-v3/include/bits/stl_map.h
index bad6020ef47..8a9e6c9c329 100644
--- a/libstdc++-v3/include/bits/stl_map.h
+++ b/libstdc++-v3/include/bits/stl_map.h
@@ -1381,6 +1381,40 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
const map<_K1, _T1, _C1, _A1>&);
};
+
+#if __cpp_deduction_guides >= 201606
+
+ template<typename _InputIterator,
+ typename _Compare = less<__iter_key_t<_InputIterator>>,
+ typename _Allocator = allocator<__iter_to_alloc_t<_InputIterator>>,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ map(_InputIterator, _InputIterator,
+ _Compare = _Compare(), _Allocator = _Allocator())
+ -> map<__iter_key_t<_InputIterator>, __iter_val_t<_InputIterator>,
+ _Compare, _Allocator>;
+
+ template<typename _Key, typename _Tp, typename _Compare = less<_Key>,
+ typename _Allocator = allocator<pair<const _Key, _Tp>>,
+ typename = _RequireAllocator<_Allocator>>
+ map(initializer_list<pair<_Key, _Tp>>,
+ _Compare = _Compare(), _Allocator = _Allocator())
+ -> map<_Key, _Tp, _Compare, _Allocator>;
+
+ template <typename _InputIterator, typename _Allocator,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ map(_InputIterator, _InputIterator, _Allocator)
+ -> map<__iter_key_t<_InputIterator>, __iter_val_t<_InputIterator>,
+ less<__iter_key_t<_InputIterator>>, _Allocator>;
+
+ template<typename _Key, typename _Tp, typename _Allocator,
+ typename = _RequireAllocator<_Allocator>>
+ map(initializer_list<pair<_Key, _Tp>>, _Allocator)
+ -> map<_Key, _Tp, less<_Key>, _Allocator>;
+
+#endif
+
/**
* @brief Map equality comparison.
* @param __x A %map.
diff --git a/libstdc++-v3/include/bits/stl_multimap.h b/libstdc++-v3/include/bits/stl_multimap.h
index 6f5cb7a47db..1a16bf982e3 100644
--- a/libstdc++-v3/include/bits/stl_multimap.h
+++ b/libstdc++-v3/include/bits/stl_multimap.h
@@ -1047,6 +1047,39 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
const multimap<_K1, _T1, _C1, _A1>&);
};
+#if __cpp_deduction_guides >= 201606
+
+ template<typename _InputIterator,
+ typename _Compare = less<__iter_key_t<_InputIterator>>,
+ typename _Allocator = allocator<__iter_to_alloc_t<_InputIterator>>,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ multimap(_InputIterator, _InputIterator,
+ _Compare = _Compare(), _Allocator = _Allocator())
+ -> multimap<__iter_key_t<_InputIterator>, __iter_val_t<_InputIterator>,
+ _Compare, _Allocator>;
+
+ template<typename _Key, typename _Tp, typename _Compare = less<_Key>,
+ typename _Allocator = allocator<pair<const _Key, _Tp>>,
+ typename = _RequireAllocator<_Allocator>>
+ multimap(initializer_list<pair<_Key, _Tp>>,
+ _Compare = _Compare(), _Allocator = _Allocator())
+ -> multimap<_Key, _Tp, _Compare, _Allocator>;
+
+ template<typename _InputIterator, typename _Allocator,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ multimap(_InputIterator, _InputIterator, _Allocator)
+ -> multimap<__iter_key_t<_InputIterator>, __iter_val_t<_InputIterator>,
+ less<__iter_key_t<_InputIterator>>, _Allocator>;
+
+ template<typename _Key, typename _Tp, typename _Allocator,
+ typename = _RequireAllocator<_Allocator>>
+ multimap(initializer_list<pair<_Key, _Tp>>, _Allocator)
+ -> multimap<_Key, _Tp, less<_Key>, _Allocator>;
+
+#endif
+
/**
* @brief Multimap equality comparison.
* @param __x A %multimap.
diff --git a/libstdc++-v3/include/bits/stl_multiset.h b/libstdc++-v3/include/bits/stl_multiset.h
index 517e77e9372..d34b6758e18 100644
--- a/libstdc++-v3/include/bits/stl_multiset.h
+++ b/libstdc++-v3/include/bits/stl_multiset.h
@@ -881,6 +881,43 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
const multiset<_K1, _C1, _A1>&);
};
+#if __cpp_deduction_guides >= 201606
+
+ template<typename _InputIterator,
+ typename _Compare =
+ less<typename iterator_traits<_InputIterator>::value_type>,
+ typename _Allocator =
+ allocator<typename iterator_traits<_InputIterator>::value_type>,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ multiset(_InputIterator, _InputIterator,
+ _Compare = _Compare(), _Allocator = _Allocator())
+ -> multiset<typename iterator_traits<_InputIterator>::value_type,
+ _Compare, _Allocator>;
+
+ template<typename _Key,
+ typename _Compare = less<_Key>,
+ typename _Allocator = allocator<_Key>,
+ typename = _RequireAllocator<_Allocator>>
+ multiset(initializer_list<_Key>,
+ _Compare = _Compare(), _Allocator = _Allocator())
+ -> multiset<_Key, _Compare, _Allocator>;
+
+ template<typename _InputIterator, typename _Allocator,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ multiset(_InputIterator, _InputIterator, _Allocator)
+ -> multiset<typename iterator_traits<_InputIterator>::value_type,
+ less<typename iterator_traits<_InputIterator>::value_type>,
+ _Allocator>;
+
+ template<typename _Key, typename _Allocator,
+ typename = _RequireAllocator<_Allocator>>
+ multiset(initializer_list<_Key>, _Allocator)
+ -> multiset<_Key, less<_Key>, _Allocator>;
+
+#endif
+
/**
* @brief Multiset equality comparison.
* @param __x A %multiset.
@@ -971,6 +1008,7 @@ _GLIBCXX_END_NAMESPACE_CONTAINER
_S_get_tree(_GLIBCXX_STD_C::multiset<_Val, _Cmp2, _Alloc>& __set)
{ return __set._M_t; }
};
+
#endif // C++17
_GLIBCXX_END_NAMESPACE_VERSION
diff --git a/libstdc++-v3/include/bits/stl_set.h b/libstdc++-v3/include/bits/stl_set.h
index e804a7cae70..3a7992c4dab 100644
--- a/libstdc++-v3/include/bits/stl_set.h
+++ b/libstdc++-v3/include/bits/stl_set.h
@@ -898,6 +898,41 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
operator<(const set<_K1, _C1, _A1>&, const set<_K1, _C1, _A1>&);
};
+#if __cpp_deduction_guides >= 201606
+
+ template<typename _InputIterator,
+ typename _Compare =
+ less<typename iterator_traits<_InputIterator>::value_type>,
+ typename _Allocator =
+ allocator<typename iterator_traits<_InputIterator>::value_type>,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ set(_InputIterator, _InputIterator,
+ _Compare = _Compare(), _Allocator = _Allocator())
+ -> set<typename iterator_traits<_InputIterator>::value_type,
+ _Compare, _Allocator>;
+
+ template<typename _Key, typename _Compare = less<_Key>,
+ typename _Allocator = allocator<_Key>,
+ typename = _RequireAllocator<_Allocator>>
+ set(initializer_list<_Key>,
+ _Compare = _Compare(), _Allocator = _Allocator())
+ -> set<_Key, _Compare, _Allocator>;
+
+ template<typename _InputIterator, typename _Allocator,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ set(_InputIterator, _InputIterator, _Allocator)
+ -> set<typename iterator_traits<_InputIterator>::value_type,
+ less<typename iterator_traits<_InputIterator>::value_type>,
+ _Allocator>;
+
+ template<typename _Key, typename _Allocator,
+ typename = _RequireAllocator<_Allocator>>
+ set(initializer_list<_Key>, _Allocator)
+ -> set<_Key, less<_Key>, _Allocator>;
+
+#endif
/**
* @brief Set equality comparison.
diff --git a/libstdc++-v3/include/bits/unordered_map.h b/libstdc++-v3/include/bits/unordered_map.h
index 2fd4cd54962..385e4bd4df4 100644
--- a/libstdc++-v3/include/bits/unordered_map.h
+++ b/libstdc++-v3/include/bits/unordered_map.h
@@ -1130,6 +1130,82 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
const unordered_map<_Key1, _Tp1, _Hash1, _Pred1, _Alloc1>&);
};
+#if __cpp_deduction_guides >= 201606
+
+ template<typename _InputIterator,
+ typename _Hash = hash<__iter_key_t<_InputIterator>>,
+ typename _Pred = equal_to<__iter_key_t<_InputIterator>>,
+ typename _Allocator = allocator<__iter_to_alloc_t<_InputIterator>>,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_map(_InputIterator, _InputIterator,
+ typename unordered_map<int, int>::size_type = {},
+ _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
+ -> unordered_map<__iter_key_t<_InputIterator>,
+ __iter_val_t<_InputIterator>,
+ _Hash, _Pred, _Allocator>;
+
+ template<typename _Key, typename _Tp, typename _Hash = hash<_Key>,
+ typename _Pred = equal_to<_Key>,
+ typename _Allocator = allocator<pair<const _Key, _Tp>>,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_map(initializer_list<pair<_Key, _Tp>>,
+ typename unordered_map<int, int>::size_type = {},
+ _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
+ -> unordered_map<_Key, _Tp, _Hash, _Pred, _Allocator>;
+
+ template<typename _InputIterator, typename _Allocator,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_map(_InputIterator, _InputIterator,
+ typename unordered_map<int, int>::size_type, _Allocator)
+ -> unordered_map<__iter_key_t<_InputIterator>,
+ __iter_val_t<_InputIterator>,
+ hash<__iter_key_t<_InputIterator>>,
+ equal_to<__iter_key_t<_InputIterator>>,
+ _Allocator>;
+
+ template<typename _InputIterator, typename _Allocator,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_map(_InputIterator, _InputIterator, _Allocator)
+ -> unordered_map<__iter_key_t<_InputIterator>,
+ __iter_val_t<_InputIterator>,
+ hash<__iter_key_t<_InputIterator>>,
+ equal_to<__iter_key_t<_InputIterator>>,
+ _Allocator>;
+
+ template<typename _InputIterator, typename _Hash, typename _Allocator,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_map(_InputIterator, _InputIterator,
+ typename unordered_map<int, int>::size_type,
+ _Hash, _Allocator)
+ -> unordered_map<__iter_key_t<_InputIterator>,
+ __iter_val_t<_InputIterator>, _Hash,
+ equal_to<__iter_key_t<_InputIterator>>, _Allocator>;
+
+ template<typename _Key, typename _Tp, typename _Allocator,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_map(initializer_list<pair<_Key, _Tp>>,
+ typename unordered_map<int, int>::size_type,
+ _Allocator)
+ -> unordered_map<_Key, _Tp, hash<_Key>, equal_to<_Key>, _Allocator>;
+
+ template<typename _Key, typename _Tp, typename _Allocator,
+ _RequireAllocator<_Allocator>>
+ unordered_map(initializer_list<pair<_Key, _Tp>>, _Allocator)
+ -> unordered_map<_Key, _Tp, hash<_Key>, equal_to<_Key>, _Allocator>;
+
+ template<typename _Key, typename _Tp, typename _Hash, typename _Allocator,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_map(initializer_list<pair<_Key, _Tp>>,
+ typename unordered_map<int, int>::size_type,
+ _Hash, _Allocator)
+ -> unordered_map<_Key, _Tp, _Hash, equal_to<_Key>, _Allocator>;
+
+#endif
+
/**
* @brief A standard container composed of equivalent keys
* (possibly containing multiple of each key value) that associates
@@ -1893,6 +1969,82 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
_Hash1, _Pred1, _Alloc1>&);
};
+#if __cpp_deduction_guides >= 201606
+
+ template<typename _InputIterator,
+ typename _Hash = hash<__iter_key_t<_InputIterator>>,
+ typename _Pred = equal_to<__iter_key_t<_InputIterator>>,
+ typename _Allocator = allocator<__iter_to_alloc_t<_InputIterator>>,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_multimap(_InputIterator, _InputIterator,
+ unordered_multimap<int, int>::size_type = {},
+ _Hash = _Hash(), _Pred = _Pred(),
+ _Allocator = _Allocator())
+ -> unordered_multimap<__iter_key_t<_InputIterator>,
+ __iter_val_t<_InputIterator>, _Hash, _Pred,
+ _Allocator>;
+
+ template<typename _Key, typename _Tp, typename _Hash = hash<_Key>,
+ typename _Pred = equal_to<_Key>,
+ typename _Allocator = allocator<pair<const _Key, _Tp>>,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_multimap(initializer_list<pair<_Key, _Tp>>,
+ unordered_multimap<int, int>::size_type = {},
+ _Hash = _Hash(), _Pred = _Pred(),
+ _Allocator = _Allocator())
+ -> unordered_multimap<_Key, _Tp, _Hash, _Pred, _Allocator>;
+
+ template<typename _InputIterator, typename _Allocator,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_multimap(_InputIterator, _InputIterator,
+ unordered_multimap<int, int>::size_type, _Allocator)
+ -> unordered_multimap<__iter_key_t<_InputIterator>,
+ __iter_val_t<_InputIterator>,
+ hash<__iter_key_t<_InputIterator>>,
+ equal_to<__iter_key_t<_InputIterator>>, _Allocator>;
+
+ template<typename _InputIterator, typename _Allocator,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_multimap(_InputIterator, _InputIterator, _Allocator)
+ -> unordered_multimap<__iter_key_t<_InputIterator>,
+ __iter_val_t<_InputIterator>,
+ hash<__iter_key_t<_InputIterator>>,
+ equal_to<__iter_key_t<_InputIterator>>, _Allocator>;
+
+ template<typename _InputIterator, typename _Hash, typename _Allocator,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_multimap(_InputIterator, _InputIterator,
+ unordered_multimap<int, int>::size_type, _Hash,
+ _Allocator)
+ -> unordered_multimap<__iter_key_t<_InputIterator>,
+ __iter_val_t<_InputIterator>, _Hash,
+ equal_to<__iter_key_t<_InputIterator>>, _Allocator>;
+
+ template<typename _Key, typename _Tp, typename _Allocator,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_multimap(initializer_list<pair<_Key, _Tp>>,
+ unordered_multimap<int, int>::size_type,
+ _Allocator)
+ -> unordered_multimap<_Key, _Tp, hash<_Key>, equal_to<_Key>, _Allocator>;
+
+ template<typename _Key, typename _Tp, typename _Allocator,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_multimap(initializer_list<pair<_Key, _Tp>>, _Allocator)
+ -> unordered_multimap<_Key, _Tp, hash<_Key>, equal_to<_Key>, _Allocator>;
+
+ template<typename _Key, typename _Tp, typename _Hash, typename _Allocator,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_multimap(initializer_list<pair<_Key, _Tp>>,
+ unordered_multimap<int, int>::size_type,
+ _Hash, _Allocator)
+ -> unordered_multimap<_Key, _Tp, _Hash, equal_to<_Key>, _Allocator>;
+
+#endif
+
template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline void
swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
diff --git a/libstdc++-v3/include/bits/unordered_set.h b/libstdc++-v3/include/bits/unordered_set.h
index df57915f31a..416dbbcfb96 100644
--- a/libstdc++-v3/include/bits/unordered_set.h
+++ b/libstdc++-v3/include/bits/unordered_set.h
@@ -805,6 +805,70 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
const unordered_set<_Value1, _Hash1, _Pred1, _Alloc1>&);
};
+#if __cpp_deduction_guides >= 201606
+
+ template<typename _InputIterator,
+ typename _Hash =
+ hash<typename iterator_traits<_InputIterator>::value_type>,
+ typename _Pred =
+ equal_to<typename iterator_traits<_InputIterator>::value_type>,
+ typename _Allocator =
+ allocator<typename iterator_traits<_InputIterator>::value_type>,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_set(_InputIterator, _InputIterator,
+ unordered_set<int>::size_type = {},
+ _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
+ -> unordered_set<typename iterator_traits<_InputIterator>::value_type,
+ _Hash, _Pred, _Allocator>;
+
+ template<typename _Tp, typename _Hash = hash<_Tp>,
+ typename _Pred = equal_to<_Tp>,
+ typename _Allocator = allocator<_Tp>,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_set(initializer_list<_Tp>,
+ unordered_set<int>::size_type = {},
+ _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
+ -> unordered_set<_Tp, _Hash, _Pred, _Allocator>;
+
+ template<typename _InputIterator, typename _Allocator,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_set(_InputIterator, _InputIterator,
+ unordered_set<int>::size_type, _Allocator)
+ -> unordered_set<typename iterator_traits<_InputIterator>::value_type,
+ hash<
+ typename iterator_traits<_InputIterator>::value_type>,
+ equal_to<
+ typename iterator_traits<_InputIterator>::value_type>,
+ _Allocator>;
+
+ template<typename _InputIterator, typename _Hash, typename _Allocator,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_set(_InputIterator, _InputIterator,
+ unordered_set<int>::size_type,
+ _Hash, _Allocator)
+ -> unordered_set<typename iterator_traits<_InputIterator>::value_type,
+ _Hash,
+ equal_to<
+ typename iterator_traits<_InputIterator>::value_type>,
+ _Allocator>;
+
+ template<typename _Tp, typename _Allocator,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_set(initializer_list<_Tp>,
+ unordered_set<int>::size_type, _Allocator)
+ -> unordered_set<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
+
+ template<typename _Tp, typename _Hash, typename _Allocator,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_set(initializer_list<_Tp>,
+ unordered_set<int>::size_type, _Hash, _Allocator)
+ -> unordered_set<_Tp, _Hash, equal_to<_Tp>, _Allocator>;
+
+#endif
+
/**
* @brief A standard container composed of equivalent keys
* (possibly containing multiple of each key value) in which the
@@ -1517,6 +1581,75 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
const unordered_multiset<_Value1, _Hash1, _Pred1, _Alloc1>&);
};
+
+#if __cpp_deduction_guides >= 201606
+
+ template<typename _InputIterator,
+ typename _Hash =
+ hash<typename iterator_traits<_InputIterator>::value_type>,
+ typename _Pred =
+ equal_to<typename iterator_traits<_InputIterator>::value_type>,
+ typename _Allocator =
+ allocator<typename iterator_traits<_InputIterator>::value_type>,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_multiset(_InputIterator, _InputIterator,
+ unordered_multiset<int>::size_type = {},
+ _Hash = _Hash(), _Pred = _Pred(),
+ _Allocator = _Allocator())
+ -> unordered_multiset<typename iterator_traits<_InputIterator>::value_type,
+ _Hash, _Pred, _Allocator>;
+
+ template<typename _Tp, typename _Hash = hash<_Tp>,
+ typename _Pred = equal_to<_Tp>,
+ typename _Allocator = allocator<_Tp>,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_multiset(initializer_list<_Tp>,
+ unordered_multiset<int>::size_type = {},
+ _Hash = _Hash(), _Pred = _Pred(),
+ _Allocator = _Allocator())
+ -> unordered_multiset<_Tp, _Hash, _Pred, _Allocator>;
+
+ template<typename _InputIterator, typename _Allocator,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_multiset(_InputIterator, _InputIterator,
+ unordered_multiset<int>::size_type, _Allocator)
+ -> unordered_multiset<typename iterator_traits<_InputIterator>::value_type,
+ hash<typename
+ iterator_traits<_InputIterator>::value_type>,
+ equal_to<typename
+ iterator_traits<_InputIterator>::value_type>,
+ _Allocator>;
+
+ template<typename _InputIterator, typename _Hash, typename _Allocator,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_multiset(_InputIterator, _InputIterator,
+ unordered_multiset<int>::size_type,
+ _Hash, _Allocator)
+ -> unordered_multiset<typename
+ iterator_traits<_InputIterator>::value_type,
+ _Hash,
+ equal_to<
+ typename
+ iterator_traits<_InputIterator>::value_type>,
+ _Allocator>;
+
+ template<typename _Tp, typename _Allocator,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_multiset(initializer_list<_Tp>,
+ unordered_multiset<int>::size_type, _Allocator)
+ -> unordered_multiset<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
+
+ template<typename _Tp, typename _Hash, typename _Allocator,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_multiset(initializer_list<_Tp>,
+ unordered_multiset<int>::size_type, _Hash, _Allocator)
+ -> unordered_multiset<_Tp, _Hash, equal_to<_Tp>, _Allocator>;
+
+#endif
+
template<class _Value, class _Hash, class _Pred, class _Alloc>
inline void
swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
diff --git a/libstdc++-v3/include/debug/deque b/libstdc++-v3/include/debug/deque
index 7e3c193c103..5816b4b1624 100644
--- a/libstdc++-v3/include/debug/deque
+++ b/libstdc++-v3/include/debug/deque
@@ -624,6 +624,16 @@ namespace __debug
_M_base() const _GLIBCXX_NOEXCEPT { return *this; }
};
+#if __cpp_deduction_guides >= 201606
+ template<typename _InputIterator, typename _ValT
+ = typename iterator_traits<_InputIterator>::value_type,
+ typename _Allocator = allocator<_ValT>,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ deque(_InputIterator, _InputIterator, _Allocator = _Allocator())
+ -> deque<_ValT, _Allocator>;
+#endif
+
template<typename _Tp, typename _Alloc>
inline bool
operator==(const deque<_Tp, _Alloc>& __lhs,
diff --git a/libstdc++-v3/include/debug/forward_list b/libstdc++-v3/include/debug/forward_list
index cd343302b00..20c7ebe4a8f 100644
--- a/libstdc++-v3/include/debug/forward_list
+++ b/libstdc++-v3/include/debug/forward_list
@@ -772,6 +772,16 @@ namespace __debug
_M_base() const noexcept { return *this; }
};
+#if __cpp_deduction_guides >= 201606
+ template<typename _InputIterator, typename _ValT
+ = typename iterator_traits<_InputIterator>::value_type,
+ typename _Allocator = allocator<_ValT>,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ forward_list(_InputIterator, _InputIterator, _Allocator = _Allocator())
+ -> forward_list<_ValT, _Allocator>;
+#endif
+
template<typename _Tp, typename _Alloc>
bool
operator==(const forward_list<_Tp, _Alloc>& __lx,
diff --git a/libstdc++-v3/include/debug/list b/libstdc++-v3/include/debug/list
index a45ece244bd..94d325c6e6a 100644
--- a/libstdc++-v3/include/debug/list
+++ b/libstdc++-v3/include/debug/list
@@ -769,6 +769,16 @@ namespace __debug
_M_base() const _GLIBCXX_NOEXCEPT { return *this; }
};
+#if __cpp_deduction_guides >= 201606
+ template<typename _InputIterator, typename _ValT
+ = typename iterator_traits<_InputIterator>::value_type,
+ typename _Allocator = allocator<_ValT>,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ list(_InputIterator, _InputIterator, _Allocator = _Allocator())
+ -> list<_ValT, _Allocator>;
+#endif
+
template<typename _Tp, typename _Alloc>
inline bool
operator==(const list<_Tp, _Alloc>& __lhs,
diff --git a/libstdc++-v3/include/debug/map.h b/libstdc++-v3/include/debug/map.h
index c275979052c..d5a2c9f6e6f 100644
--- a/libstdc++-v3/include/debug/map.h
+++ b/libstdc++-v3/include/debug/map.h
@@ -667,6 +667,39 @@ namespace __debug
_M_base() const _GLIBCXX_NOEXCEPT { return *this; }
};
+#if __cpp_deduction_guides >= 201606
+
+ template<typename _InputIterator,
+ typename _Compare = less<__iter_key_t<_InputIterator>>,
+ typename _Allocator = allocator<__iter_to_alloc_t<_InputIterator>>,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ map(_InputIterator, _InputIterator,
+ _Compare = _Compare(), _Allocator = _Allocator())
+ -> map<__iter_key_t<_InputIterator>, __iter_val_t<_InputIterator>,
+ _Compare, _Allocator>;
+
+ template<typename _Key, typename _Tp, typename _Compare = less<_Key>,
+ typename _Allocator = allocator<pair<const _Key, _Tp>>,
+ typename = _RequireAllocator<_Allocator>>
+ map(initializer_list<pair<_Key, _Tp>>,
+ _Compare = _Compare(), _Allocator = _Allocator())
+ -> map<_Key, _Tp, _Compare, _Allocator>;
+
+ template <typename _InputIterator, typename _Allocator,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ map(_InputIterator, _InputIterator, _Allocator)
+ -> map<__iter_key_t<_InputIterator>, __iter_val_t<_InputIterator>,
+ less<__iter_key_t<_InputIterator>>, _Allocator>;
+
+ template<typename _Key, typename _Tp, typename _Allocator,
+ typename = _RequireAllocator<_Allocator>>
+ map(initializer_list<pair<_Key, _Tp>>, _Allocator)
+ -> map<_Key, _Tp, less<_Key>, _Allocator>;
+
+#endif
+
template<typename _Key, typename _Tp,
typename _Compare, typename _Allocator>
inline bool
diff --git a/libstdc++-v3/include/debug/multimap.h b/libstdc++-v3/include/debug/multimap.h
index f971cfa41f0..6c7b2ab4f8d 100644
--- a/libstdc++-v3/include/debug/multimap.h
+++ b/libstdc++-v3/include/debug/multimap.h
@@ -555,6 +555,39 @@ namespace __debug
_M_base() const _GLIBCXX_NOEXCEPT { return *this; }
};
+#if __cpp_deduction_guides >= 201606
+
+ template<typename _InputIterator,
+ typename _Compare = less<__iter_key_t<_InputIterator>>,
+ typename _Allocator = allocator<__iter_to_alloc_t<_InputIterator>>,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ multimap(_InputIterator, _InputIterator,
+ _Compare = _Compare(), _Allocator = _Allocator())
+ -> multimap<__iter_key_t<_InputIterator>, __iter_val_t<_InputIterator>,
+ _Compare, _Allocator>;
+
+ template<typename _Key, typename _Tp, typename _Compare = less<_Key>,
+ typename _Allocator = allocator<pair<const _Key, _Tp>>,
+ typename = _RequireAllocator<_Allocator>>
+ multimap(initializer_list<pair<_Key, _Tp>>,
+ _Compare = _Compare(), _Allocator = _Allocator())
+ -> multimap<_Key, _Tp, _Compare, _Allocator>;
+
+ template<typename _InputIterator, typename _Allocator,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ multimap(_InputIterator, _InputIterator, _Allocator)
+ -> multimap<__iter_key_t<_InputIterator>, __iter_val_t<_InputIterator>,
+ less<__iter_key_t<_InputIterator>>, _Allocator>;
+
+ template<typename _Key, typename _Tp, typename _Allocator,
+ typename = _RequireAllocator<_Allocator>>
+ multimap(initializer_list<pair<_Key, _Tp>>, _Allocator)
+ -> multimap<_Key, _Tp, less<_Key>, _Allocator>;
+
+#endif
+
template<typename _Key, typename _Tp,
typename _Compare, typename _Allocator>
inline bool
diff --git a/libstdc++-v3/include/debug/multiset.h b/libstdc++-v3/include/debug/multiset.h
index 97c7b843f27..59331b4bc6b 100644
--- a/libstdc++-v3/include/debug/multiset.h
+++ b/libstdc++-v3/include/debug/multiset.h
@@ -542,6 +542,43 @@ namespace __debug
_M_base() const _GLIBCXX_NOEXCEPT { return *this; }
};
+#if __cpp_deduction_guides >= 201606
+
+ template<typename _InputIterator,
+ typename _Compare =
+ less<typename iterator_traits<_InputIterator>::value_type>,
+ typename _Allocator =
+ allocator<typename iterator_traits<_InputIterator>::value_type>,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ multiset(_InputIterator, _InputIterator,
+ _Compare = _Compare(), _Allocator = _Allocator())
+ -> multiset<typename iterator_traits<_InputIterator>::value_type,
+ _Compare, _Allocator>;
+
+ template<typename _Key,
+ typename _Compare = less<_Key>,
+ typename _Allocator = allocator<_Key>,
+ typename = _RequireAllocator<_Allocator>>
+ multiset(initializer_list<_Key>,
+ _Compare = _Compare(), _Allocator = _Allocator())
+ -> multiset<_Key, _Compare, _Allocator>;
+
+ template<typename _InputIterator, typename _Allocator,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ multiset(_InputIterator, _InputIterator, _Allocator)
+ -> multiset<typename iterator_traits<_InputIterator>::value_type,
+ less<typename iterator_traits<_InputIterator>::value_type>,
+ _Allocator>;
+
+ template<typename _Key, typename _Allocator,
+ typename = _RequireAllocator<_Allocator>>
+ multiset(initializer_list<_Key>, _Allocator)
+ -> multiset<_Key, less<_Key>, _Allocator>;
+
+#endif
+
template<typename _Key, typename _Compare, typename _Allocator>
inline bool
operator==(const multiset<_Key, _Compare, _Allocator>& __lhs,
diff --git a/libstdc++-v3/include/debug/set.h b/libstdc++-v3/include/debug/set.h
index 07032865bc9..5353cfe87b2 100644
--- a/libstdc++-v3/include/debug/set.h
+++ b/libstdc++-v3/include/debug/set.h
@@ -560,6 +560,42 @@ namespace __debug
_M_base() const _GLIBCXX_NOEXCEPT { return *this; }
};
+#if __cpp_deduction_guides >= 201606
+
+ template<typename _InputIterator,
+ typename _Compare =
+ less<typename iterator_traits<_InputIterator>::value_type>,
+ typename _Allocator =
+ allocator<typename iterator_traits<_InputIterator>::value_type>,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ set(_InputIterator, _InputIterator,
+ _Compare = _Compare(), _Allocator = _Allocator())
+ -> set<typename iterator_traits<_InputIterator>::value_type,
+ _Compare, _Allocator>;
+
+ template<typename _Key, typename _Compare = less<_Key>,
+ typename _Allocator = allocator<_Key>,
+ typename = _RequireAllocator<_Allocator>>
+ set(initializer_list<_Key>,
+ _Compare = _Compare(), _Allocator = _Allocator())
+ -> set<_Key, _Compare, _Allocator>;
+
+ template<typename _InputIterator, typename _Allocator,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ set(_InputIterator, _InputIterator, _Allocator)
+ -> set<typename iterator_traits<_InputIterator>::value_type,
+ less<typename iterator_traits<_InputIterator>::value_type>,
+ _Allocator>;
+
+ template<typename _Key, typename _Allocator,
+ typename = _RequireAllocator<_Allocator>>
+ set(initializer_list<_Key>, _Allocator)
+ -> set<_Key, less<_Key>, _Allocator>;
+
+#endif
+
template<typename _Key, typename _Compare, typename _Allocator>
inline bool
operator==(const set<_Key, _Compare, _Allocator>& __lhs,
diff --git a/libstdc++-v3/include/debug/unordered_map b/libstdc++-v3/include/debug/unordered_map
index 51a55ae21f3..c5734304846 100644
--- a/libstdc++-v3/include/debug/unordered_map
+++ b/libstdc++-v3/include/debug/unordered_map
@@ -616,6 +616,82 @@ namespace __debug
}
};
+#if __cpp_deduction_guides >= 201606
+
+ template<typename _InputIterator,
+ typename _Hash = hash<__iter_key_t<_InputIterator>>,
+ typename _Pred = equal_to<__iter_key_t<_InputIterator>>,
+ typename _Allocator = allocator<__iter_to_alloc_t<_InputIterator>>,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_map(_InputIterator, _InputIterator,
+ typename unordered_map<int, int>::size_type = {},
+ _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
+ -> unordered_map<__iter_key_t<_InputIterator>,
+ __iter_val_t<_InputIterator>,
+ _Hash, _Pred, _Allocator>;
+
+ template<typename _Key, typename _Tp, typename _Hash = hash<_Key>,
+ typename _Pred = equal_to<_Key>,
+ typename _Allocator = allocator<pair<const _Key, _Tp>>,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_map(initializer_list<pair<_Key, _Tp>>,
+ typename unordered_map<int, int>::size_type = {},
+ _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
+ -> unordered_map<_Key, _Tp, _Hash, _Pred, _Allocator>;
+
+ template<typename _InputIterator, typename _Allocator,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_map(_InputIterator, _InputIterator,
+ typename unordered_map<int, int>::size_type, _Allocator)
+ -> unordered_map<__iter_key_t<_InputIterator>,
+ __iter_val_t<_InputIterator>,
+ hash<__iter_key_t<_InputIterator>>,
+ equal_to<__iter_key_t<_InputIterator>>,
+ _Allocator>;
+
+ template<typename _InputIterator, typename _Allocator,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_map(_InputIterator, _InputIterator, _Allocator)
+ -> unordered_map<__iter_key_t<_InputIterator>,
+ __iter_val_t<_InputIterator>,
+ hash<__iter_key_t<_InputIterator>>,
+ equal_to<__iter_key_t<_InputIterator>>,
+ _Allocator>;
+
+ template<typename _InputIterator, typename _Hash, typename _Allocator,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_map(_InputIterator, _InputIterator,
+ typename unordered_map<int, int>::size_type,
+ _Hash, _Allocator)
+ -> unordered_map<__iter_key_t<_InputIterator>,
+ __iter_val_t<_InputIterator>, _Hash,
+ equal_to<__iter_key_t<_InputIterator>>, _Allocator>;
+
+ template<typename _Key, typename _Tp, typename _Allocator,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_map(initializer_list<pair<_Key, _Tp>>,
+ typename unordered_map<int, int>::size_type,
+ _Allocator)
+ -> unordered_map<_Key, _Tp, hash<_Key>, equal_to<_Key>, _Allocator>;
+
+ template<typename _Key, typename _Tp, typename _Allocator,
+ _RequireAllocator<_Allocator>>
+ unordered_map(initializer_list<pair<_Key, _Tp>>, _Allocator)
+ -> unordered_map<_Key, _Tp, hash<_Key>, equal_to<_Key>, _Allocator>;
+
+ template<typename _Key, typename _Tp, typename _Hash, typename _Allocator,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_map(initializer_list<pair<_Key, _Tp>>,
+ typename unordered_map<int, int>::size_type,
+ _Hash, _Allocator)
+ -> unordered_map<_Key, _Tp, _Hash, equal_to<_Key>, _Allocator>;
+
+#endif
+
template<typename _Key, typename _Tp, typename _Hash,
typename _Pred, typename _Alloc>
inline void
@@ -1110,6 +1186,82 @@ namespace __debug
}
};
+#if __cpp_deduction_guides >= 201606
+
+ template<typename _InputIterator,
+ typename _Hash = hash<__iter_key_t<_InputIterator>>,
+ typename _Pred = equal_to<__iter_key_t<_InputIterator>>,
+ typename _Allocator = allocator<__iter_to_alloc_t<_InputIterator>>,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_multimap(_InputIterator, _InputIterator,
+ unordered_multimap<int, int>::size_type = {},
+ _Hash = _Hash(), _Pred = _Pred(),
+ _Allocator = _Allocator())
+ -> unordered_multimap<__iter_key_t<_InputIterator>,
+ __iter_val_t<_InputIterator>, _Hash, _Pred,
+ _Allocator>;
+
+ template<typename _Key, typename _Tp, typename _Hash = hash<_Key>,
+ typename _Pred = equal_to<_Key>,
+ typename _Allocator = allocator<pair<const _Key, _Tp>>,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_multimap(initializer_list<pair<_Key, _Tp>>,
+ unordered_multimap<int, int>::size_type = {},
+ _Hash = _Hash(), _Pred = _Pred(),
+ _Allocator = _Allocator())
+ -> unordered_multimap<_Key, _Tp, _Hash, _Pred, _Allocator>;
+
+ template<typename _InputIterator, typename _Allocator,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_multimap(_InputIterator, _InputIterator,
+ unordered_multimap<int, int>::size_type, _Allocator)
+ -> unordered_multimap<__iter_key_t<_InputIterator>,
+ __iter_val_t<_InputIterator>,
+ hash<__iter_key_t<_InputIterator>>,
+ equal_to<__iter_key_t<_InputIterator>>, _Allocator>;
+
+ template<typename _InputIterator, typename _Allocator,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_multimap(_InputIterator, _InputIterator, _Allocator)
+ -> unordered_multimap<__iter_key_t<_InputIterator>,
+ __iter_val_t<_InputIterator>,
+ hash<__iter_key_t<_InputIterator>>,
+ equal_to<__iter_key_t<_InputIterator>>, _Allocator>;
+
+ template<typename _InputIterator, typename _Hash, typename _Allocator,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_multimap(_InputIterator, _InputIterator,
+ unordered_multimap<int, int>::size_type, _Hash,
+ _Allocator)
+ -> unordered_multimap<__iter_key_t<_InputIterator>,
+ __iter_val_t<_InputIterator>, _Hash,
+ equal_to<__iter_key_t<_InputIterator>>, _Allocator>;
+
+ template<typename _Key, typename _Tp, typename _Allocator,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_multimap(initializer_list<pair<_Key, _Tp>>,
+ unordered_multimap<int, int>::size_type,
+ _Allocator)
+ -> unordered_multimap<_Key, _Tp, hash<_Key>, equal_to<_Key>, _Allocator>;
+
+ template<typename _Key, typename _Tp, typename _Allocator,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_multimap(initializer_list<pair<_Key, _Tp>>, _Allocator)
+ -> unordered_multimap<_Key, _Tp, hash<_Key>, equal_to<_Key>, _Allocator>;
+
+ template<typename _Key, typename _Tp, typename _Hash, typename _Allocator,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_multimap(initializer_list<pair<_Key, _Tp>>,
+ unordered_multimap<int, int>::size_type,
+ _Hash, _Allocator)
+ -> unordered_multimap<_Key, _Tp, _Hash, equal_to<_Key>, _Allocator>;
+
+#endif
+
template<typename _Key, typename _Tp, typename _Hash,
typename _Pred, typename _Alloc>
inline void
diff --git a/libstdc++-v3/include/debug/unordered_set b/libstdc++-v3/include/debug/unordered_set
index 923ff2bc4d8..1fe493fe52f 100644
--- a/libstdc++-v3/include/debug/unordered_set
+++ b/libstdc++-v3/include/debug/unordered_set
@@ -530,6 +530,70 @@ namespace __debug
}
};
+#if __cpp_deduction_guides >= 201606
+
+ template<typename _InputIterator,
+ typename _Hash =
+ hash<typename iterator_traits<_InputIterator>::value_type>,
+ typename _Pred =
+ equal_to<typename iterator_traits<_InputIterator>::value_type>,
+ typename _Allocator =
+ allocator<typename iterator_traits<_InputIterator>::value_type>,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_set(_InputIterator, _InputIterator,
+ unordered_set<int>::size_type = {},
+ _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
+ -> unordered_set<typename iterator_traits<_InputIterator>::value_type,
+ _Hash, _Pred, _Allocator>;
+
+ template<typename _Tp, typename _Hash = hash<_Tp>,
+ typename _Pred = equal_to<_Tp>,
+ typename _Allocator = allocator<_Tp>,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_set(initializer_list<_Tp>,
+ unordered_set<int>::size_type = {},
+ _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
+ -> unordered_set<_Tp, _Hash, _Pred, _Allocator>;
+
+ template<typename _InputIterator, typename _Allocator,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_set(_InputIterator, _InputIterator,
+ unordered_set<int>::size_type, _Allocator)
+ -> unordered_set<typename iterator_traits<_InputIterator>::value_type,
+ hash<
+ typename iterator_traits<_InputIterator>::value_type>,
+ equal_to<
+ typename iterator_traits<_InputIterator>::value_type>,
+ _Allocator>;
+
+ template<typename _InputIterator, typename _Hash, typename _Allocator,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_set(_InputIterator, _InputIterator,
+ unordered_set<int>::size_type,
+ _Hash, _Allocator)
+ -> unordered_set<typename iterator_traits<_InputIterator>::value_type,
+ _Hash,
+ equal_to<
+ typename iterator_traits<_InputIterator>::value_type>,
+ _Allocator>;
+
+ template<typename _Tp, typename _Allocator,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_set(initializer_list<_Tp>,
+ unordered_set<int>::size_type, _Allocator)
+ -> unordered_set<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
+
+ template<typename _Tp, typename _Hash, typename _Allocator,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_set(initializer_list<_Tp>,
+ unordered_set<int>::size_type, _Hash, _Allocator)
+ -> unordered_set<_Tp, _Hash, equal_to<_Tp>, _Allocator>;
+
+#endif
+
template<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
inline void
swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
@@ -1012,6 +1076,74 @@ namespace __debug
}
};
+#if __cpp_deduction_guides >= 201606
+
+ template<typename _InputIterator,
+ typename _Hash =
+ hash<typename iterator_traits<_InputIterator>::value_type>,
+ typename _Pred =
+ equal_to<typename iterator_traits<_InputIterator>::value_type>,
+ typename _Allocator =
+ allocator<typename iterator_traits<_InputIterator>::value_type>,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_multiset(_InputIterator, _InputIterator,
+ unordered_multiset<int>::size_type = {},
+ _Hash = _Hash(), _Pred = _Pred(),
+ _Allocator = _Allocator())
+ -> unordered_multiset<typename iterator_traits<_InputIterator>::value_type,
+ _Hash, _Pred, _Allocator>;
+
+ template<typename _Tp, typename _Hash = hash<_Tp>,
+ typename _Pred = equal_to<_Tp>,
+ typename _Allocator = allocator<_Tp>,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_multiset(initializer_list<_Tp>,
+ unordered_multiset<int>::size_type = {},
+ _Hash = _Hash(), _Pred = _Pred(),
+ _Allocator = _Allocator())
+ -> unordered_multiset<_Tp, _Hash, _Pred, _Allocator>;
+
+ template<typename _InputIterator, typename _Allocator,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_multiset(_InputIterator, _InputIterator,
+ unordered_multiset<int>::size_type, _Allocator)
+ -> unordered_multiset<typename iterator_traits<_InputIterator>::value_type,
+ hash<typename
+ iterator_traits<_InputIterator>::value_type>,
+ equal_to<typename
+ iterator_traits<_InputIterator>::value_type>,
+ _Allocator>;
+
+ template<typename _InputIterator, typename _Hash, typename _Allocator,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_multiset(_InputIterator, _InputIterator,
+ unordered_multiset<int>::size_type,
+ _Hash, _Allocator)
+ -> unordered_multiset<typename
+ iterator_traits<_InputIterator>::value_type,
+ _Hash,
+ equal_to<
+ typename
+ iterator_traits<_InputIterator>::value_type>,
+ _Allocator>;
+
+ template<typename _Tp, typename _Allocator,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_multiset(initializer_list<_Tp>,
+ unordered_multiset<int>::size_type, _Allocator)
+ -> unordered_multiset<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
+
+ template<typename _Tp, typename _Hash, typename _Allocator,
+ typename = _RequireAllocator<_Allocator>>
+ unordered_multiset(initializer_list<_Tp>,
+ unordered_multiset<int>::size_type, _Hash, _Allocator)
+ -> unordered_multiset<_Tp, _Hash, equal_to<_Tp>, _Allocator>;
+
+#endif
+
template<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
inline void
swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
diff --git a/libstdc++-v3/include/debug/vector b/libstdc++-v3/include/debug/vector
index a6d18d94508..c24c2f3d45f 100644
--- a/libstdc++-v3/include/debug/vector
+++ b/libstdc++-v3/include/debug/vector
@@ -757,6 +757,16 @@ namespace __debug
_GLIBCXX_NOEXCEPT_IF(noexcept(__lhs.swap(__rhs)))
{ __lhs.swap(__rhs); }
+#if __cpp_deduction_guides >= 201606
+ template<typename _InputIterator, typename _ValT
+ = typename iterator_traits<_InputIterator>::value_type,
+ typename _Allocator = allocator<_ValT>,
+ typename = _RequireInputIter<_InputIterator>,
+ typename = _RequireAllocator<_Allocator>>
+ vector(_InputIterator, _InputIterator, _Allocator = _Allocator())
+ -> vector<_ValT, _Allocator>;
+#endif
+
} // namespace __debug
#if __cplusplus >= 201103L
diff --git a/libstdc++-v3/testsuite/23_containers/map/cons/deduction.cc b/libstdc++-v3/testsuite/23_containers/map/cons/deduction.cc
new file mode 100644
index 00000000000..3880cd5e79d
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/map/cons/deduction.cc
@@ -0,0 +1,68 @@
+// { dg-options "-std=gnu++17" }
+// { dg-do compile { target c++17 } }
+
+#include <map>
+#include <testsuite_allocator.h>
+
+using __gnu_test::SimpleAllocator;
+
+static_assert(std::is_same_v<
+ decltype(std::map{std::pair{1, 2.0}, {2, 3.0}, {3, 4.0}}),
+ std::map<int, double>>);
+
+static_assert(std::is_same_v<
+ decltype(std::map{{std::pair{1, 2.0}, {2, 3.0}, {3, 4.0}}}),
+ std::map<int, double>>);
+
+static_assert(std::is_same_v<
+ decltype(std::map{{std::pair{1, 2.0}, {2, 3.0}, {3, 4.0}},
+ std::less<int>{}, {}}),
+ std::map<int, double>>);
+
+static_assert(std::is_same_v<
+ decltype(std::map{{std::pair{1, 2.0}, {2, 3.0}, {3, 4.0}},
+ {}}),
+ std::map<int, double>>);
+
+static_assert(std::is_same_v<
+ decltype(std::map{{std::pair{1, 2.0}, {2, 3.0}, {3, 4.0}},
+ {}, SimpleAllocator<std::pair<const int, double>>{}}),
+ std::map<int, double, std::less<int>,
+ SimpleAllocator<std::pair<const int, double>>>>);
+
+void f()
+{
+ std::map<int, double> x;
+ static_assert(std::is_same_v<
+ decltype(std::map(x.begin(), x.end())),
+ std::map<int, double>>);
+
+ static_assert(std::is_same_v<
+ decltype(std::map{x.begin(), x.end(),
+ std::less<int>{},
+ std::allocator<std::pair<const int, double>>{}}),
+ std::map<int, double>>);
+
+ static_assert(std::is_same_v<
+ decltype(std::map{x.begin(), x.end(),
+ std::less<int>{}, {}}),
+ std::map<int, double>>);
+
+ static_assert(std::is_same_v<
+ decltype(std::map(x.begin(), x.end(),
+ {})),
+ std::map<int, double>>);
+
+ static_assert(std::is_same_v<
+ decltype(std::map{x.begin(), x.end(),
+ {},
+ std::allocator<std::pair<const int, double>>{}}),
+ std::map<int, double>>);
+
+ static_assert(std::is_same_v<
+ decltype(std::map{x.begin(), x.end(),
+ {},
+ SimpleAllocator<std::pair<const int, double>>{}}),
+ std::map<int, double, std::less<int>,
+ SimpleAllocator<std::pair<const int, double>>>>);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/multimap/cons/deduction.cc b/libstdc++-v3/testsuite/23_containers/multimap/cons/deduction.cc
new file mode 100644
index 00000000000..ee48bfda26b
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/multimap/cons/deduction.cc
@@ -0,0 +1,68 @@
+// { dg-options "-std=gnu++17" }
+// { dg-do compile { target c++17 } }
+
+#include <map>
+#include <testsuite_allocator.h>
+
+using __gnu_test::SimpleAllocator;
+
+static_assert(std::is_same_v<
+ decltype(std::multimap{std::pair{1, 2.0}, {2, 3.0}, {3, 4.0}}),
+ std::multimap<int, double>>);
+
+static_assert(std::is_same_v<
+ decltype(std::multimap{{std::pair{1, 2.0}, {2, 3.0}, {3, 4.0}}}),
+ std::multimap<int, double>>);
+
+static_assert(std::is_same_v<
+ decltype(std::multimap{{std::pair{1, 2.0}, {2, 3.0}, {3, 4.0}},
+ std::less<int>{}, {}}),
+ std::multimap<int, double>>);
+
+static_assert(std::is_same_v<
+ decltype(std::multimap{{std::pair{1, 2.0}, {2, 3.0}, {3, 4.0}},
+ {}}),
+ std::multimap<int, double>>);
+
+static_assert(std::is_same_v<
+ decltype(std::multimap{{std::pair{1, 2.0}, {2, 3.0}, {3, 4.0}},
+ {}, SimpleAllocator<std::pair<const int, double>>{}}),
+ std::multimap<int, double, std::less<int>,
+ SimpleAllocator<std::pair<const int, double>>>>);
+
+void f()
+{
+ std::multimap<int, double> x;
+ static_assert(std::is_same_v<
+ decltype(std::multimap(x.begin(), x.end())),
+ std::multimap<int, double>>);
+
+ static_assert(std::is_same_v<
+ decltype(std::multimap{x.begin(), x.end(),
+ std::less<int>{},
+ std::allocator<std::pair<const int, double>>{}}),
+ std::multimap<int, double>>);
+
+ static_assert(std::is_same_v<
+ decltype(std::multimap{x.begin(), x.end(),
+ std::less<int>{}, {}}),
+ std::multimap<int, double>>);
+
+ static_assert(std::is_same_v<
+ decltype(std::multimap(x.begin(), x.end(),
+ {})),
+ std::multimap<int, double>>);
+
+ static_assert(std::is_same_v<
+ decltype(std::multimap{x.begin(), x.end(),
+ {},
+ std::allocator<std::pair<const int, double>>{}}),
+ std::multimap<int, double>>);
+
+ static_assert(std::is_same_v<
+ decltype(std::multimap{x.begin(), x.end(),
+ {},
+ SimpleAllocator<std::pair<const int, double>>{}}),
+ std::multimap<int, double, std::less<int>,
+ SimpleAllocator<std::pair<const int, double>>>>);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/multiset/cons/deduction.cc b/libstdc++-v3/testsuite/23_containers/multiset/cons/deduction.cc
new file mode 100644
index 00000000000..4ca3f98129a
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/multiset/cons/deduction.cc
@@ -0,0 +1,68 @@
+// { dg-options "-std=gnu++17" }
+// { dg-do compile { target c++17 } }
+
+#include <set>
+#include <testsuite_allocator.h>
+
+using __gnu_test::SimpleAllocator;
+
+static_assert(std::is_same_v<
+ decltype(std::multiset{1, 2, 3}),
+ std::multiset<int>>);
+
+static_assert(std::is_same_v<
+ decltype(std::multiset{1, 2, 3}),
+ std::multiset<int>>);
+
+static_assert(std::is_same_v<
+ decltype(std::multiset{{1, 2, 3},
+ std::less<int>{}, {}}),
+ std::multiset<int>>);
+
+static_assert(std::is_same_v<
+ decltype(std::multiset{{1, 2, 3},
+ {}}),
+ std::multiset<int>>);
+
+static_assert(std::is_same_v<
+ decltype(std::multiset{{1, 2, 3},
+ {}, SimpleAllocator<int>{}}),
+ std::multiset<int, std::less<int>,
+ SimpleAllocator<int>>>);
+
+void f()
+{
+ std::multiset<int> x;
+
+ static_assert(std::is_same_v<
+ decltype(std::multiset(x.begin(), x.end())),
+ std::multiset<int>>);
+
+ static_assert(std::is_same_v<
+ decltype(std::multiset{x.begin(), x.end(),
+ std::less<int>{},
+ std::allocator<int>{}}),
+ std::multiset<int>>);
+
+ static_assert(std::is_same_v<
+ decltype(std::multiset{x.begin(), x.end(),
+ std::less<int>{}, {}}),
+ std::multiset<int>>);
+
+ static_assert(std::is_same_v<
+ decltype(std::multiset(x.begin(), x.end(),
+ {})),
+ std::multiset<int>>);
+
+ static_assert(std::is_same_v<
+ decltype(std::multiset{x.begin(), x.end(),
+ {},
+ std::allocator<int>{}}),
+ std::multiset<int>>);
+
+ static_assert(std::is_same_v<
+ decltype(std::multiset{x.begin(), x.end(),
+ {},
+ SimpleAllocator<int>{}}),
+ std::multiset<int, std::less<int>, SimpleAllocator<int>>>);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/cons/deduction.cc b/libstdc++-v3/testsuite/23_containers/set/cons/deduction.cc
new file mode 100644
index 00000000000..73d5cfdd227
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/cons/deduction.cc
@@ -0,0 +1,68 @@
+// { dg-options "-std=gnu++17" }
+// { dg-do compile { target c++17 } }
+
+#include <set>
+#include <testsuite_allocator.h>
+
+using __gnu_test::SimpleAllocator;
+
+static_assert(std::is_same_v<
+ decltype(std::set{1, 2, 3}),
+ std::set<int>>);
+
+static_assert(std::is_same_v<
+ decltype(std::set{1, 2, 3}),
+ std::set<int>>);
+
+static_assert(std::is_same_v<
+ decltype(std::set{{1, 2, 3},
+ std::less<int>{}, {}}),
+ std::set<int>>);
+
+static_assert(std::is_same_v<
+ decltype(std::set{{1, 2, 3},
+ {}}),
+ std::set<int>>);
+
+static_assert(std::is_same_v<
+ decltype(std::set{{1, 2, 3},
+ {}, SimpleAllocator<int>{}}),
+ std::set<int, std::less<int>,
+ SimpleAllocator<int>>>);
+
+void f()
+{
+ std::set<int> x;
+
+ static_assert(std::is_same_v<
+ decltype(std::set(x.begin(), x.end())),
+ std::set<int>>);
+
+ static_assert(std::is_same_v<
+ decltype(std::set{x.begin(), x.end(),
+ std::less<int>{},
+ std::allocator<int>{}}),
+ std::set<int>>);
+
+ static_assert(std::is_same_v<
+ decltype(std::set{x.begin(), x.end(),
+ std::less<int>{}, {}}),
+ std::set<int>>);
+
+ static_assert(std::is_same_v<
+ decltype(std::set(x.begin(), x.end(),
+ {})),
+ std::set<int>>);
+
+ static_assert(std::is_same_v<
+ decltype(std::set{x.begin(), x.end(),
+ {},
+ std::allocator<int>{}}),
+ std::set<int>>);
+
+ static_assert(std::is_same_v<
+ decltype(std::set{x.begin(), x.end(),
+ {},
+ SimpleAllocator<int>{}}),
+ std::set<int, std::less<int>, SimpleAllocator<int>>>);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/cons/deduction.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/cons/deduction.cc
new file mode 100644
index 00000000000..1905b20116b
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/cons/deduction.cc
@@ -0,0 +1,77 @@
+// { dg-options "-std=gnu++17" }
+// { dg-do compile { target c++17 } }
+
+#include <unordered_map>
+#include <testsuite_allocator.h>
+
+using __gnu_test::SimpleAllocator;
+
+static_assert(std::is_same_v<
+ decltype(std::unordered_map{std::pair{1, 2.0},
+ {2, 3.0}, {3, 4.0}}),
+ std::unordered_map<int, double>>);
+
+static_assert(std::is_same_v<
+ decltype(std::unordered_map{{std::pair{1, 2.0},
+ {2, 3.0}, {3, 4.0}}}),
+ std::unordered_map<int, double>>);
+
+static_assert(std::is_same_v<
+ decltype(std::unordered_map{{std::pair{1, 2.0},
+ {2, 3.0}, {3, 4.0}},
+ {}, std::hash<int>{}, {}}),
+ std::unordered_map<int, double>>);
+
+static_assert(std::is_same_v<
+ decltype(std::unordered_map{{std::pair{1, 2.0},
+ {2, 3.0}, {3, 4.0}},
+ {}}),
+ std::unordered_map<int, double>>);
+
+static_assert(std::is_same_v<
+ decltype(std::unordered_map{{std::pair{1, 2.0},
+ {2, 3.0}, {3, 4.0}},
+ {}, {}, {},
+ SimpleAllocator<std::pair<const int, double>>{}}),
+ std::unordered_map<int, double, std::hash<int>,
+ std::equal_to<int>,
+ SimpleAllocator<std::pair<const int, double>>>>);
+
+
+void f()
+{
+ std::unordered_map<int, double> x;
+ static_assert(std::is_same_v<
+ decltype(std::unordered_map(x.begin(), x.end())),
+ std::unordered_map<int, double>>);
+
+ static_assert(std::is_same_v<
+ decltype(std::unordered_map{x.begin(), x.end(),
+ {}, std::hash<int>{}, {},
+ std::allocator<std::pair<const int, double>>{}}),
+ std::unordered_map<int, double>>);
+
+ static_assert(std::is_same_v<
+ decltype(std::unordered_map{x.begin(), x.end(),
+ {}, std::hash<int>{}, {}}),
+ std::unordered_map<int, double>>);
+
+ static_assert(std::is_same_v<
+ decltype(std::unordered_map(x.begin(), x.end(),
+ {})),
+ std::unordered_map<int, double>>);
+
+ static_assert(std::is_same_v<
+ decltype(std::unordered_map{x.begin(), x.end(),
+ {}, {}, {},
+ std::allocator<std::pair<const int, double>>{}}),
+ std::unordered_map<int, double>>);
+
+ static_assert(std::is_same_v<
+ decltype(std::unordered_map{x.begin(), x.end(),
+ {}, {}, {},
+ SimpleAllocator<std::pair<const int, double>>{}}),
+ std::unordered_map<int, double, std::hash<int>,
+ std::equal_to<int>,
+ SimpleAllocator<std::pair<const int, double>>>>);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/cons/deduction.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/cons/deduction.cc
new file mode 100644
index 00000000000..db5e32b4ad2
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/cons/deduction.cc
@@ -0,0 +1,77 @@
+// { dg-options "-std=gnu++17" }
+// { dg-do compile { target c++17 } }
+
+#include <unordered_map>
+#include <testsuite_allocator.h>
+
+using __gnu_test::SimpleAllocator;
+
+static_assert(std::is_same_v<
+ decltype(std::unordered_multimap{std::pair{1, 2.0},
+ {2, 3.0}, {3, 4.0}}),
+ std::unordered_multimap<int, double>>);
+
+static_assert(std::is_same_v<
+ decltype(std::unordered_multimap{{std::pair{1, 2.0},
+ {2, 3.0}, {3, 4.0}}}),
+ std::unordered_multimap<int, double>>);
+
+static_assert(std::is_same_v<
+ decltype(std::unordered_multimap{{std::pair{1, 2.0},
+ {2, 3.0}, {3, 4.0}},
+ {}, std::hash<int>{}, {}}),
+ std::unordered_multimap<int, double>>);
+
+static_assert(std::is_same_v<
+ decltype(std::unordered_multimap{{std::pair{1, 2.0},
+ {2, 3.0}, {3, 4.0}},
+ {}}),
+ std::unordered_multimap<int, double>>);
+
+static_assert(std::is_same_v<
+ decltype(std::unordered_multimap{{std::pair{1, 2.0},
+ {2, 3.0}, {3, 4.0}},
+ {}, {}, {},
+ SimpleAllocator<std::pair<const int, double>>{}}),
+ std::unordered_multimap<int, double, std::hash<int>,
+ std::equal_to<int>,
+ SimpleAllocator<std::pair<const int, double>>>>);
+
+
+void f()
+{
+ std::unordered_multimap<int, double> x;
+ static_assert(std::is_same_v<
+ decltype(std::unordered_multimap(x.begin(), x.end())),
+ std::unordered_multimap<int, double>>);
+
+ static_assert(std::is_same_v<
+ decltype(std::unordered_multimap{x.begin(), x.end(),
+ {}, std::hash<int>{}, {},
+ std::allocator<std::pair<const int, double>>{}}),
+ std::unordered_multimap<int, double>>);
+
+ static_assert(std::is_same_v<
+ decltype(std::unordered_multimap{x.begin(), x.end(),
+ {}, std::hash<int>{}, {}}),
+ std::unordered_multimap<int, double>>);
+
+ static_assert(std::is_same_v<
+ decltype(std::unordered_multimap(x.begin(), x.end(),
+ {})),
+ std::unordered_multimap<int, double>>);
+
+ static_assert(std::is_same_v<
+ decltype(std::unordered_multimap{x.begin(), x.end(),
+ {}, {}, {},
+ std::allocator<std::pair<const int, double>>{}}),
+ std::unordered_multimap<int, double>>);
+
+ static_assert(std::is_same_v<
+ decltype(std::unordered_multimap{x.begin(), x.end(),
+ {}, {}, {},
+ SimpleAllocator<std::pair<const int, double>>{}}),
+ std::unordered_multimap<int, double, std::hash<int>,
+ std::equal_to<int>,
+ SimpleAllocator<std::pair<const int, double>>>>);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/deduction.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/deduction.cc
new file mode 100644
index 00000000000..352176d1e7d
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/deduction.cc
@@ -0,0 +1,78 @@
+// { dg-options "-std=gnu++17" }
+// { dg-do compile { target c++17 } }
+
+#include <unordered_set>
+#include <testsuite_allocator.h>
+
+using __gnu_test::SimpleAllocator;
+
+static_assert(std::is_same_v<
+ decltype(std::unordered_multiset{1, 2, 3}),
+ std::unordered_multiset<int>>);
+
+static_assert(std::is_same_v<
+ decltype(std::unordered_multiset{1, 2, 3}),
+ std::unordered_multiset<int>>);
+
+static_assert(std::is_same_v<
+ decltype(std::unordered_multiset{{1, 2, 3},
+ 0, std::hash<int>{}, {}}),
+ std::unordered_multiset<int>>);
+
+static_assert(std::is_same_v<
+ decltype(std::unordered_multiset{{1, 2, 3},
+ {}}),
+ std::unordered_multiset<int>>);
+
+static_assert(std::is_same_v<
+ decltype(std::unordered_multiset{{1, 2, 3},
+ {}, {}, {}, std::allocator<int>{}}),
+ std::unordered_multiset<int>>);
+
+static_assert(std::is_same_v<
+ decltype(std::unordered_multiset{{1, 2, 3},
+ {}, {}, {}, SimpleAllocator<int>{}}),
+ std::unordered_multiset<int, std::hash<int>,
+ std::equal_to<int>,
+ SimpleAllocator<int>>>);
+
+void f()
+{
+ std::unordered_multiset<int> x;
+
+ static_assert(std::is_same_v<
+ decltype(std::unordered_multiset(x.begin(), x.end())),
+ std::unordered_multiset<int>>);
+
+ static_assert(std::is_same_v<
+ decltype(std::unordered_multiset{x.begin(), x.end(),
+ {},
+ std::hash<int>{},
+ std::equal_to<int>{},
+ std::allocator<int>{}}),
+ std::unordered_multiset<int>>);
+
+ static_assert(std::is_same_v<
+ decltype(std::unordered_multiset{x.begin(), x.end(),
+ {}, std::hash<int>{}, {}}),
+ std::unordered_multiset<int>>);
+
+ static_assert(std::is_same_v<
+ decltype(std::unordered_multiset(x.begin(), x.end(),
+ {})),
+ std::unordered_multiset<int>>);
+
+ static_assert(std::is_same_v<
+ decltype(std::unordered_multiset{x.begin(), x.end(),
+ {}, {}, {},
+ std::allocator<int>{}}),
+ std::unordered_multiset<int>>);
+
+ static_assert(std::is_same_v<
+ decltype(std::unordered_multiset{x.begin(), x.end(),
+ {}, {}, {},
+ SimpleAllocator<int>{}}),
+ std::unordered_multiset<int, std::hash<int>,
+ std::equal_to<int>,
+ SimpleAllocator<int>>>);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/cons/deduction.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/cons/deduction.cc
new file mode 100644
index 00000000000..c7e1798ef7d
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_set/cons/deduction.cc
@@ -0,0 +1,78 @@
+// { dg-options "-std=gnu++17" }
+// { dg-do compile { target c++17 } }
+
+#include <unordered_set>
+#include <testsuite_allocator.h>
+
+using __gnu_test::SimpleAllocator;
+
+static_assert(std::is_same_v<
+ decltype(std::unordered_set{1, 2, 3}),
+ std::unordered_set<int>>);
+
+static_assert(std::is_same_v<
+ decltype(std::unordered_set{1, 2, 3}),
+ std::unordered_set<int>>);
+
+static_assert(std::is_same_v<
+ decltype(std::unordered_set{{1, 2, 3},
+ 0, std::hash<int>{}, {}}),
+ std::unordered_set<int>>);
+
+static_assert(std::is_same_v<
+ decltype(std::unordered_set{{1, 2, 3},
+ {}}),
+ std::unordered_set<int>>);
+
+static_assert(std::is_same_v<
+ decltype(std::unordered_set{{1, 2, 3},
+ {}, {}, {}, std::allocator<int>{}}),
+ std::unordered_set<int>>);
+
+static_assert(std::is_same_v<
+ decltype(std::unordered_set{{1, 2, 3},
+ {}, {}, {}, SimpleAllocator<int>{}}),
+ std::unordered_set<int, std::hash<int>,
+ std::equal_to<int>,
+ SimpleAllocator<int>>>);
+
+void f()
+{
+ std::unordered_set<int> x;
+
+ static_assert(std::is_same_v<
+ decltype(std::unordered_set(x.begin(), x.end())),
+ std::unordered_set<int>>);
+
+ static_assert(std::is_same_v<
+ decltype(std::unordered_set{x.begin(), x.end(),
+ {},
+ std::hash<int>{},
+ std::equal_to<int>{},
+ std::allocator<int>{}}),
+ std::unordered_set<int>>);
+
+ static_assert(std::is_same_v<
+ decltype(std::unordered_set{x.begin(), x.end(),
+ {}, std::hash<int>{}, {}}),
+ std::unordered_set<int>>);
+
+ static_assert(std::is_same_v<
+ decltype(std::unordered_set(x.begin(), x.end(),
+ {})),
+ std::unordered_set<int>>);
+
+ static_assert(std::is_same_v<
+ decltype(std::unordered_set{x.begin(), x.end(),
+ {}, {}, {},
+ std::allocator<int>{}}),
+ std::unordered_set<int>>);
+
+ static_assert(std::is_same_v<
+ decltype(std::unordered_set{x.begin(), x.end(),
+ {}, {}, {},
+ SimpleAllocator<int>{}}),
+ std::unordered_set<int, std::hash<int>,
+ std::equal_to<int>,
+ SimpleAllocator<int>>>);
+}