[PATCH v2] libstdc++-v3: Implement missing allocator-aware constructors for unordered containers.
Jonathan Wakely
jwakely@redhat.com
Fri Apr 25 09:20:09 GMT 2025
On Fri, 18 Apr 2025 at 09:11, Tomasz Kamiński <tkaminsk@redhat.com> wrote:
>
> This patch implements remainder of LWG2713 (after r15-8293-g64f5c854597759)
> by adding missing allocator aware version of unordered associative containers
> constructors accepting pair of iterators or initializer_list, and corresponding
> deduction guides.
>
> libstdc++-v3/ChangeLog:
>
> * include/bits/unordered_map.h (unordered_map):
> Define constructors accepting:
> (_InputIterator, _InputIterator, const allocator_type&),
> (initializer_list<value_type>, const allocator_type&),
> (unordered_multimap): Likewise.
> * include/debug/unordered_map (unordered_map): Likewise.
> (unordered_multimap): Likewise.
> * include/bits/unordered_set.h (unordered_set):
> Define constructors and deduction guide accepting:
> (_InputIterator, _InputIterator, const allocator_type&),
> (initializer_list<value_type>, const allocator_type&),
> (unordered_multiset): Likewise.
> * include/debug/unordered_set (unordered_set): Likewise.
> (unordered_multiset): Likewise.
> * testsuite/23_containers/unordered_map/cons/66055.cc: New tests.
> * testsuite/23_containers/unordered_map/cons/deduction.cc: New tests.
> * testsuite/23_containers/unordered_multimap/cons/66055.cc: New tests.
> * testsuite/23_containers/unordered_multimap/cons/deduction.cc: New
> tests.
> * testsuite/23_containers/unordered_multiset/cons/66055.cc: New tests.
> * testsuite/23_containers/unordered_multiset/cons/deduction.cc: New
> tests.
> * testsuite/23_containers/unordered_set/cons/66055.cc: New tests.
> * testsuite/23_containers/unordered_set/cons/deduction.cc: New tests.
> ---
> I would like to merge rest of the changes, now that we are in 16.
> Tested on x86_64-linux. OK for trunk?
OK for trunk, thanks.
>
> libstdc++-v3/include/bits/unordered_map.h | 30 ++++++++
> libstdc++-v3/include/bits/unordered_set.h | 71 +++++++++++++++++++
> libstdc++-v3/include/debug/unordered_map | 22 ++++++
> libstdc++-v3/include/debug/unordered_set | 54 ++++++++++++++
> .../23_containers/unordered_map/cons/66055.cc | 11 +--
> .../unordered_map/cons/deduction.cc | 28 ++++++++
> .../unordered_multimap/cons/66055.cc | 10 +--
> .../unordered_multimap/cons/deduction.cc | 34 +++++++++
> .../unordered_multiset/cons/66055.cc | 10 +--
> .../unordered_multiset/cons/deduction.cc | 28 ++++++++
> .../23_containers/unordered_set/cons/66055.cc | 10 +--
> .../unordered_set/cons/deduction.cc | 28 ++++++++
> 12 files changed, 320 insertions(+), 16 deletions(-)
>
> diff --git a/libstdc++-v3/include/bits/unordered_map.h b/libstdc++-v3/include/bits/unordered_map.h
> index 5bc58e849ff..fc07ffc998c 100644
> --- a/libstdc++-v3/include/bits/unordered_map.h
> +++ b/libstdc++-v3/include/bits/unordered_map.h
> @@ -251,6 +251,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
> : unordered_map(__n, __hf, key_equal(), __a)
> { }
>
> + // _GLIBCXX_RESOLVE_LIB_DEFECTS
> + // 2713. More missing allocator-extended constructors for unordered containers
> + template<typename _InputIterator>
> + unordered_map(_InputIterator __first, _InputIterator __last,
> + const allocator_type& __a)
> + : unordered_map(__first, __last, 0, hasher(), key_equal(), __a)
> + { }
> +
> template<typename _InputIterator>
> unordered_map(_InputIterator __first, _InputIterator __last,
> size_type __n,
> @@ -271,6 +279,13 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
> : unordered_map(__l, __n, hasher(), key_equal(), __a)
> { }
>
> + // _GLIBCXX_RESOLVE_LIB_DEFECTS
> + // 2713. More missing allocator-extended constructors for unordered containers
> + unordered_map(initializer_list<value_type> __l,
> + const allocator_type& __a)
> + : unordered_map(__l, 0, hasher(), key_equal(), __a)
> + { }
> +
> unordered_map(initializer_list<value_type> __l,
> size_type __n, const hasher& __hf,
> const allocator_type& __a)
> @@ -1504,6 +1519,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
> : unordered_multimap(__n, __hf, key_equal(), __a)
> { }
>
> + // _GLIBCXX_RESOLVE_LIB_DEFECTS
> + // 2713. More missing allocator-extended constructors for unordered containers
> + template<typename _InputIterator>
> + unordered_multimap(_InputIterator __first, _InputIterator __last,
> + const allocator_type& __a)
> + : unordered_multimap(__first, __last, 0, hasher(), key_equal(), __a)
> + { }
> +
> template<typename _InputIterator>
> unordered_multimap(_InputIterator __first, _InputIterator __last,
> size_type __n,
> @@ -1518,6 +1541,13 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
> : unordered_multimap(__first, __last, __n, __hf, key_equal(), __a)
> { }
>
> + // _GLIBCXX_RESOLVE_LIB_DEFECTS
> + // 2713. More missing allocator-extended constructors for unordered containers
> + unordered_multimap(initializer_list<value_type> __l,
> + const allocator_type& __a)
> + : unordered_multimap(__l, 0, hasher(), key_equal(), __a)
> + { }
> +
> unordered_multimap(initializer_list<value_type> __l,
> size_type __n,
> const allocator_type& __a)
> diff --git a/libstdc++-v3/include/bits/unordered_set.h b/libstdc++-v3/include/bits/unordered_set.h
> index 091bae60e55..5649dd76e1f 100644
> --- a/libstdc++-v3/include/bits/unordered_set.h
> +++ b/libstdc++-v3/include/bits/unordered_set.h
> @@ -245,6 +245,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
> : unordered_set(__n, __hf, key_equal(), __a)
> { }
>
> + // _GLIBCXX_RESOLVE_LIB_DEFECTS
> + // 2713. More missing allocator-extended constructors for unordered container
> + template<typename _InputIterator>
> + unordered_set(_InputIterator __first, _InputIterator __last,
> + const allocator_type& __a)
> + : unordered_set(__first, __last, 0, hasher(), key_equal(), __a)
> + { }
> +
> template<typename _InputIterator>
> unordered_set(_InputIterator __first, _InputIterator __last,
> size_type __n,
> @@ -259,6 +267,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
> : unordered_set(__first, __last, __n, __hf, key_equal(), __a)
> { }
>
> +
> + // _GLIBCXX_RESOLVE_LIB_DEFECTS
> + // 2713. More missing allocator-extended constructors for unordered container
> + unordered_set(initializer_list<value_type> __l,
> + const allocator_type& __a)
> + : unordered_set(__l, 0, hasher(), key_equal(), __a)
> + { }
> +
> unordered_set(initializer_list<value_type> __l,
> size_type __n,
> const allocator_type& __a)
> @@ -987,6 +1003,19 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
> typename iterator_traits<_InputIterator>::value_type>,
> _Allocator>;
>
> + // _GLIBCXX_RESOLVE_LIB_DEFECTS
> + // 2713. More missing allocator-extended constructors for unordered container
> + template<typename _InputIterator, typename _Allocator,
> + typename = _RequireInputIter<_InputIterator>,
> + typename = _RequireAllocator<_Allocator>>
> + unordered_set(_InputIterator, _InputIterator, _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 = _RequireNotAllocatorOrIntegral<_Hash>,
> @@ -1006,6 +1035,13 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
> unordered_set<int>::size_type, _Allocator)
> -> unordered_set<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
>
> + // _GLIBCXX_RESOLVE_LIB_DEFECTS
> + // 2713. More missing allocator-extended constructors for unordered container
> + template<typename _Tp, typename _Allocator,
> + typename = _RequireAllocator<_Allocator>>
> + unordered_set(initializer_list<_Tp>, _Allocator)
> + -> unordered_set<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
> +
> template<typename _Tp, typename _Hash, typename _Allocator,
> typename = _RequireNotAllocatorOrIntegral<_Hash>,
> typename = _RequireAllocator<_Allocator>>
> @@ -1223,6 +1259,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
> : unordered_multiset(__n, __hf, key_equal(), __a)
> { }
>
> + // _GLIBCXX_RESOLVE_LIB_DEFECTS
> + // 2713. More missing allocator-extended constructors for unordered container
> + template<typename _InputIterator>
> + unordered_multiset(_InputIterator __first, _InputIterator __last,
> + const allocator_type& __a)
> + : unordered_multiset(__first, __last, 0, hasher(), key_equal(), __a)
> + { }
> +
> template<typename _InputIterator>
> unordered_multiset(_InputIterator __first, _InputIterator __last,
> size_type __n,
> @@ -1237,6 +1281,13 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
> : unordered_multiset(__first, __last, __n, __hf, key_equal(), __a)
> { }
>
> + // _GLIBCXX_RESOLVE_LIB_DEFECTS
> + // 2713. More missing allocator-extended constructors for unordered container
> + unordered_multiset(initializer_list<value_type> __l,
> + const allocator_type& __a)
> + : unordered_multiset(__l, 0, hasher(), key_equal(), __a)
> + { }
> +
> unordered_multiset(initializer_list<value_type> __l,
> size_type __n,
> const allocator_type& __a)
> @@ -1949,6 +2000,19 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
> iterator_traits<_InputIterator>::value_type>,
> _Allocator>;
>
> + // _GLIBCXX_RESOLVE_LIB_DEFECTS
> + // 2713. More missing allocator-extended constructors for unordered container
> + template<typename _InputIterator, typename _Allocator,
> + typename = _RequireInputIter<_InputIterator>,
> + typename = _RequireAllocator<_Allocator>>
> + unordered_multiset(_InputIterator, _InputIterator, _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 = _RequireNotAllocatorOrIntegral<_Hash>,
> @@ -1970,6 +2034,13 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
> unordered_multiset<int>::size_type, _Allocator)
> -> unordered_multiset<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
>
> + // _GLIBCXX_RESOLVE_LIB_DEFECTS
> + // 2713. More missing allocator-extended constructors for unordered container
> + template<typename _Tp, typename _Allocator,
> + typename = _RequireAllocator<_Allocator>>
> + unordered_multiset(initializer_list<_Tp>, _Allocator)
> + -> unordered_multiset<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
> +
> template<typename _Tp, typename _Hash, typename _Allocator,
> typename = _RequireNotAllocatorOrIntegral<_Hash>,
> typename = _RequireAllocator<_Allocator>>
> diff --git a/libstdc++-v3/include/debug/unordered_map b/libstdc++-v3/include/debug/unordered_map
> index 448f681e16b..7673db10b09 100644
> --- a/libstdc++-v3/include/debug/unordered_map
> +++ b/libstdc++-v3/include/debug/unordered_map
> @@ -173,6 +173,12 @@ namespace __debug
> : unordered_map(__n, __hf, key_equal(), __a)
> { }
>
> + template<typename _InputIterator>
> + unordered_map(_InputIterator __first, _InputIterator __last,
> + const allocator_type& __a)
> + : unordered_map(__first, __last, 0, hasher(), key_equal(), __a)
> + { }
> +
> template<typename _InputIterator>
> unordered_map(_InputIterator __first, _InputIterator __last,
> size_type __n,
> @@ -188,6 +194,11 @@ namespace __debug
> : unordered_map(__first, __last, __n, __hf, key_equal(), __a)
> { }
>
> + unordered_map(initializer_list<value_type> __l,
> + const allocator_type& __a)
> + : unordered_map(__l, 0, hasher(), key_equal(), __a)
> + { }
> +
> unordered_map(initializer_list<value_type> __l,
> size_type __n,
> const allocator_type& __a)
> @@ -1051,6 +1062,12 @@ namespace __debug
> : unordered_multimap(__n, __hf, key_equal(), __a)
> { }
>
> + template<typename _InputIterator>
> + unordered_multimap(_InputIterator __first, _InputIterator __last,
> + const allocator_type& __a)
> + : unordered_multimap(__first, __last, 0, hasher(), key_equal(), __a)
> + { }
> +
> template<typename _InputIterator>
> unordered_multimap(_InputIterator __first, _InputIterator __last,
> size_type __n,
> @@ -1065,6 +1082,11 @@ namespace __debug
> : unordered_multimap(__first, __last, __n, __hf, key_equal(), __a)
> { }
>
> + unordered_multimap(initializer_list<value_type> __l,
> + const allocator_type& __a)
> + : unordered_multimap(__l, 0, hasher(), key_equal(), __a)
> + { }
> +
> unordered_multimap(initializer_list<value_type> __l,
> size_type __n,
> const allocator_type& __a)
> diff --git a/libstdc++-v3/include/debug/unordered_set b/libstdc++-v3/include/debug/unordered_set
> index 4255f6ee770..932600d55e3 100644
> --- a/libstdc++-v3/include/debug/unordered_set
> +++ b/libstdc++-v3/include/debug/unordered_set
> @@ -168,6 +168,12 @@ namespace __debug
> : unordered_set(__n, __hf, key_equal(), __a)
> { }
>
> + template<typename _InputIterator>
> + unordered_set(_InputIterator __first, _InputIterator __last,
> + const allocator_type& __a)
> + : unordered_set(__first, __last, 0, hasher(), key_equal(), __a)
> + { }
> +
> template<typename _InputIterator>
> unordered_set(_InputIterator __first, _InputIterator __last,
> size_type __n,
> @@ -182,6 +188,11 @@ namespace __debug
> : unordered_set(__first, __last, __n, __hf, key_equal(), __a)
> { }
>
> + unordered_set(initializer_list<value_type> __l,
> + const allocator_type& __a)
> + : unordered_set(__l, 0, hasher(), key_equal(), __a)
> + { }
> +
> unordered_set(initializer_list<value_type> __l,
> size_type __n,
> const allocator_type& __a)
> @@ -713,6 +724,17 @@ namespace __debug
> typename iterator_traits<_InputIterator>::value_type>,
> _Allocator>;
>
> + template<typename _InputIterator, typename _Allocator,
> + typename = _RequireInputIter<_InputIterator>,
> + typename = _RequireAllocator<_Allocator>>
> + unordered_set(_InputIterator, _InputIterator, _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 = _RequireNotAllocatorOrIntegral<_Hash>,
> @@ -732,6 +754,11 @@ namespace __debug
> unordered_set<int>::size_type, _Allocator)
> -> unordered_set<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
>
> + template<typename _Tp, typename _Allocator,
> + typename = _RequireAllocator<_Allocator>>
> + unordered_set(initializer_list<_Tp>, _Allocator)
> + -> unordered_set<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
> +
> template<typename _Tp, typename _Hash, typename _Allocator,
> typename = _RequireNotAllocatorOrIntegral<_Hash>,
> typename = _RequireAllocator<_Allocator>>
> @@ -876,6 +903,12 @@ namespace __debug
> : unordered_multiset(__n, __hf, key_equal(), __a)
> { }
>
> + template<typename _InputIterator>
> + unordered_multiset(_InputIterator __first, _InputIterator __last,
> + const allocator_type& __a)
> + : unordered_multiset(__first, __last, 0, hasher(), key_equal(), __a)
> + { }
> +
> template<typename _InputIterator>
> unordered_multiset(_InputIterator __first, _InputIterator __last,
> size_type __n,
> @@ -890,6 +923,11 @@ namespace __debug
> : unordered_multiset(__first, __last, __n, __hf, key_equal(), __a)
> { }
>
> + unordered_multiset(initializer_list<value_type> __l,
> + const allocator_type& __a)
> + : unordered_multiset(__l, 0, hasher(), key_equal(), __a)
> + { }
> +
> unordered_multiset(initializer_list<value_type> __l,
> size_type __n,
> const allocator_type& __a)
> @@ -1416,6 +1454,17 @@ namespace __debug
> iterator_traits<_InputIterator>::value_type>,
> _Allocator>;
>
> + template<typename _InputIterator, typename _Allocator,
> + typename = _RequireInputIter<_InputIterator>,
> + typename = _RequireAllocator<_Allocator>>
> + unordered_multiset(_InputIterator, _InputIterator, _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 = _RequireNotAllocatorOrIntegral<_Hash>,
> @@ -1437,6 +1486,11 @@ namespace __debug
> unordered_multiset<int>::size_type, _Allocator)
> -> unordered_multiset<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
>
> + template<typename _Tp, typename _Allocator,
> + typename = _RequireAllocator<_Allocator>>
> + unordered_multiset(initializer_list<_Tp>, _Allocator)
> + -> unordered_multiset<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
> +
> template<typename _Tp, typename _Hash, typename _Allocator,
> typename = _RequireNotAllocatorOrIntegral<_Hash>,
> typename = _RequireAllocator<_Allocator>>
> diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/cons/66055.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/cons/66055.cc
> index c7a12c14425..0f959760713 100644
> --- a/libstdc++-v3/testsuite/23_containers/unordered_map/cons/66055.cc
> +++ b/libstdc++-v3/testsuite/23_containers/unordered_map/cons/66055.cc
> @@ -27,7 +27,10 @@ using alloc_type = test_type::allocator_type;
>
> test_type h1(10, alloc_type());
> test_type h2(10, hasher_type(), alloc_type());
> -test_type h3(h1.begin(), h1.end(), 10, alloc_type());
> -test_type h4(h1.begin(), h1.end(), 10, hasher_type(), alloc_type());
> -test_type h5({ { 1, 1 } }, 10, alloc_type());
> -test_type h6({ { 1, 1 } }, 10, hasher_type(), alloc_type());
> +test_type h3(h1.begin(), h1.end(), alloc_type());
> +test_type h4(h1.begin(), h1.end(), 10, alloc_type());
> +test_type h5(h1.begin(), h1.end(), 10, hasher_type(), alloc_type());
> +test_type h6({ { 1, 1 } }, alloc_type());
> +test_type h7({ { 1, 1 } }, 10, alloc_type());
> +test_type h8({ { 1, 1 } }, 10, hasher_type(), alloc_type());
> +
> diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/cons/deduction.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/cons/deduction.cc
> index 8b69af896a2..fa182f5866d 100644
> --- a/libstdc++-v3/testsuite/23_containers/unordered_map/cons/deduction.cc
> +++ b/libstdc++-v3/testsuite/23_containers/unordered_map/cons/deduction.cc
> @@ -15,12 +15,28 @@ static_assert(std::is_same_v<
> {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>>>>);
> +
> static_assert(std::is_same_v<
> decltype(std::unordered_map{
> {std::pair{1, 2.0}, {2, 3.0}, {3, 4.0}},
> 1}),
> 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}},
> + 1, SimpleAllocator<std::pair<const int, double>>{}}),
> + std::unordered_map<int, double, std::hash<int>,
> + std::equal_to<int>,
> + SimpleAllocator<std::pair<const int, double>>>>);
> +
> static_assert(std::is_same_v<
> decltype(std::unordered_map{{std::pair{1, 2.0},
> {2, 3.0}, {3, 4.0}},
> @@ -96,6 +112,18 @@ void f()
> std::equal_to<int>,
> SimpleAllocator<std::pair<const 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>>>>);
> +
> static_assert(std::is_same_v<
> decltype(std::unordered_map{x.begin(), x.end(),
> 1, std::hash<int>{},
> diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/cons/66055.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/cons/66055.cc
> index dc0a65196c8..eecc60024fe 100644
> --- a/libstdc++-v3/testsuite/23_containers/unordered_multimap/cons/66055.cc
> +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/cons/66055.cc
> @@ -27,7 +27,9 @@ using alloc_type = test_type::allocator_type;
>
> test_type h1(10, alloc_type());
> test_type h2(10, hasher_type(), alloc_type());
> -test_type h3(h1.begin(), h1.end(), 10, alloc_type());
> -test_type h4(h1.begin(), h1.end(), 10, hasher_type(), alloc_type());
> -test_type h5({ { 1, 1 } }, 10, alloc_type());
> -test_type h6({ { 1, 1 } }, 10, hasher_type(), alloc_type());
> +test_type h3(h1.begin(), h1.end(), alloc_type());
> +test_type h4(h1.begin(), h1.end(), 10, alloc_type());
> +test_type h5(h1.begin(), h1.end(), 10, hasher_type(), alloc_type());
> +test_type h6({ { 1, 1 } }, alloc_type());
> +test_type h7({ { 1, 1 } }, 10, alloc_type());
> +test_type h8({ { 1, 1 } }, 10, hasher_type(), alloc_type());
> diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/cons/deduction.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/cons/deduction.cc
> index e7e535b527a..4de23fe3e79 100644
> --- a/libstdc++-v3/testsuite/23_containers/unordered_multimap/cons/deduction.cc
> +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/cons/deduction.cc
> @@ -15,6 +15,28 @@ static_assert(std::is_same_v<
> {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>>>>);
> +
> +static_assert(std::is_same_v<
> + decltype(std::unordered_multimap{
> + {std::pair{1, 2.0}, {2, 3.0}, {3, 4.0}},
> + 1}),
> + 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}},
> + 1, SimpleAllocator<std::pair<const int, double>>{}}),
> + std::unordered_multimap<int, double, std::hash<int>,
> + std::equal_to<int>,
> + SimpleAllocator<std::pair<const int, double>>>>);
> +
> static_assert(std::is_same_v<
> decltype(std::unordered_multimap{{std::pair{1, 2.0},
> {2, 3.0}, {3, 4.0}},
> @@ -105,6 +127,18 @@ void f()
> std::equal_to<int>,
> SimpleAllocator<std::pair<const 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>>>>);
> +
> static_assert(std::is_same_v<
> decltype(std::unordered_multimap{x.begin(), x.end(),
> 1, std::hash<int>{},
> diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/66055.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/66055.cc
> index 5c34b94c00d..3ba609fc449 100644
> --- a/libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/66055.cc
> +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/66055.cc
> @@ -27,7 +27,9 @@ using alloc_type = test_type::allocator_type;
>
> test_type h1(10, alloc_type());
> test_type h2(10, hasher_type(), alloc_type());
> -test_type h3(h1.begin(), h1.end(), 10, alloc_type());
> -test_type h4(h1.begin(), h1.end(), 10, hasher_type(), alloc_type());
> -test_type h5({ 1, 1 }, 10, alloc_type());
> -test_type h6({ 1, 1 }, 10, hasher_type(), alloc_type());
> +test_type h3(h1.begin(), h1.end(), alloc_type());
> +test_type h4(h1.begin(), h1.end(), 10, alloc_type());
> +test_type h5(h1.begin(), h1.end(), 10, hasher_type(), alloc_type());
> +test_type h6({ 1, 1 }, alloc_type());
> +test_type h7({ 1, 1 }, 10, alloc_type());
> +test_type h9({ 1, 1 }, 10, hasher_type(), alloc_type());
> diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/deduction.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/deduction.cc
> index 22b729749e2..46cd2105acc 100644
> --- a/libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/deduction.cc
> +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/deduction.cc
> @@ -19,6 +19,22 @@ static_assert(std::is_same_v<
> 0, std::hash<int>{}, std::allocator<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>>>);
> +
> static_assert(std::is_same_v<
> decltype(std::unordered_multiset{{1, 2, 3},
> {}}),
> @@ -86,6 +102,18 @@ void f()
> {}, std::hash<int>{}, std::equal_to<int>{}}),
> 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>>>);
> +
> static_assert(std::is_same_v<
> decltype(std::unordered_multiset{x.begin(), x.end(),
> {}, std::hash<int>{}, std::allocator<int>{}}),
> diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/cons/66055.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/cons/66055.cc
> index 0d318a04b2b..96c0ca3be53 100644
> --- a/libstdc++-v3/testsuite/23_containers/unordered_set/cons/66055.cc
> +++ b/libstdc++-v3/testsuite/23_containers/unordered_set/cons/66055.cc
> @@ -27,7 +27,9 @@ using alloc_type = test_type::allocator_type;
>
> test_type h1(10, alloc_type());
> test_type h2(10, hasher_type(), alloc_type());
> -test_type h3(h1.begin(), h1.end(), 10, alloc_type());
> -test_type h4(h1.begin(), h1.end(), 10, hasher_type(), alloc_type());
> -test_type h5({ 1, 1 }, 10, alloc_type());
> -test_type h6({ 1, 1 }, 10, hasher_type(), alloc_type());
> +test_type h3(h1.begin(), h1.end(), alloc_type());
> +test_type h4(h1.begin(), h1.end(), 10, alloc_type());
> +test_type h5(h1.begin(), h1.end(), 10, hasher_type(), alloc_type());
> +test_type h6({ 1, 1 }, alloc_type());
> +test_type h7({ 1, 1 }, 10, alloc_type());
> +test_type h9({ 1, 1 }, 10, hasher_type(), alloc_type());
> diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/cons/deduction.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/cons/deduction.cc
> index db5858132fc..9558d70505f 100644
> --- a/libstdc++-v3/testsuite/23_containers/unordered_set/cons/deduction.cc
> +++ b/libstdc++-v3/testsuite/23_containers/unordered_set/cons/deduction.cc
> @@ -19,6 +19,22 @@ static_assert(std::is_same_v<
> 0, std::hash<int>{}, std::allocator<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>>>);
> +
> static_assert(std::is_same_v<
> decltype(std::unordered_set{{1, 2, 3},
> {}}),
> @@ -91,6 +107,18 @@ void f()
> {})),
> 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>>>);
> +
> static_assert(std::is_same_v<
> decltype(std::unordered_set{x.begin(), x.end(), 1}),
> std::unordered_set<int>>);
> --
> 2.49.0
>
More information about the Libstdc++
mailing list