]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Support maps deduction from_range of tuples.
authorTomasz Kamiński <tkaminsk@redhat.com>
Wed, 19 Mar 2025 10:42:50 +0000 (11:42 +0100)
committerTomasz Kamiński <tkaminsk@redhat.com>
Wed, 19 Mar 2025 13:49:22 +0000 (14:49 +0100)
commitd50171bc07006dfb56cae487d72913e5d2567716
tree57ad86cedfb0dd5802c7c95402fba9cb97b6a4e9
parent9030c54d3ff983cf07752173737f627a2e458426
libstdc++: Support maps deduction from_range of tuples.

This implements part of LWG4223 that enables deduction for maps types
(map, unordered_map, flat_map and non-unique equivalent) from
(from_range, rg, ...) arguments, where rg is range of tuple
or other pair-like.

libstdc++-v3/ChangeLog:

* include/bits/ranges_base.h (__detail::__range_key_type):
Replace RV::first_type with tuple_element_t<0, RV>.
(__detail::__range_mapped_type) Replace RV::second_type
with tuple_element_t<1, RV>.
* testsuite/23_containers/flat_map/1.cc: New tests.
* testsuite/23_containers/flat_multimap/1.cc: New tests.
* testsuite/23_containers/map/cons/from_range.cc: New tests.
* testsuite/23_containers/multimap/cons/from_range.cc: New tests.
* testsuite/23_containers/unordered_map/cons/from_range.cc: New tests.
* testsuite/23_containers/unordered_multimap/cons/from_range.cc:
New tests.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
libstdc++-v3/include/bits/ranges_base.h
libstdc++-v3/testsuite/23_containers/flat_map/1.cc
libstdc++-v3/testsuite/23_containers/flat_multimap/1.cc
libstdc++-v3/testsuite/23_containers/map/cons/from_range.cc
libstdc++-v3/testsuite/23_containers/multimap/cons/from_range.cc
libstdc++-v3/testsuite/23_containers/unordered_map/cons/from_range.cc
libstdc++-v3/testsuite/23_containers/unordered_multimap/cons/from_range.cc