]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++-v3: Implement allocator-aware from_range_t constructors for unordered conta...
authorTomasz Kamiński <tkaminsk@redhat.com>
Tue, 18 Mar 2025 15:10:48 +0000 (16:10 +0100)
committerTomasz Kamiński <tkaminsk@redhat.com>
Wed, 19 Mar 2025 12:52:32 +0000 (13:52 +0100)
commit64f5c854597759fd11648b7d9e3884b8c69f218f
tree8a5845931797757d92905e108908c44e0d5e068b
parent73987e69d1b24e3807b94ec7cf5d859b93b9ae78
libstdc++-v3: Implement allocator-aware from_range_t constructors for unordered containers.

This patch implements part of LWG2713 covering the from_range
constructors, which makes std::ranges::to<std::unordered_set>(alloc)
well-formed. Likewise for rest of unordered containers.

As this consturctors were added to v15, this has no impact
on code that compiled with previous versions.

libstdc++-v3/ChangeLog:

* include/bits/unordered_map.h
(unordered_map(from_range_t, _Rg&&, const allocator_type&))
(unordered_multimap(from_range_t, _Rg&&, const allocator_type&)):
Define.
* include/bits/unordered_set.h
(unordered_set(from_range_t, _Rg&&, const allocator_type&))
(unordered_multiset(from_range_t, _Rg&&, const allocator_type&)):
Define.
* testsuite/23_containers/unordered_map/cons/from_range.cc: New tests.
New tests.
* testsuite/23_containers/unordered_multimap/cons/from_range.cc:
New tests.
* testsuite/23_containers/unordered_multiset/cons/from_range.cc:
New tests.
* testsuite/23_containers/unordered_set/cons/from_range.cc: New tests.
* testsuite/std/ranges/conv/1.cc: New tests.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
libstdc++-v3/include/bits/unordered_map.h
libstdc++-v3/include/bits/unordered_set.h
libstdc++-v3/testsuite/23_containers/unordered_map/cons/from_range.cc
libstdc++-v3/testsuite/23_containers/unordered_multimap/cons/from_range.cc
libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/from_range.cc
libstdc++-v3/testsuite/23_containers/unordered_set/cons/from_range.cc
libstdc++-v3/testsuite/std/ranges/conv/1.cc