Implement LWG-4223 Deduction guides for maps are mishandling tuples and references#6305
Open
frederick-vs-ja wants to merge 2 commits into
Open
Implement LWG-4223 Deduction guides for maps are mishandling tuples and references#6305frederick-vs-ja wants to merge 2 commits into
frederick-vs-ja wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR implements LWG-4223 fixes for C++ standard library deduction guides, ensuring that associative container deduction guides properly strip cv-qualifiers and references from key and value types.
Changes:
- Updates
_Guide_key_t,_Guide_val_t,_Guide_pair_t,_Range_key_type,_Range_mapped_type, and_Range_to_alloc_typeto useremove_cvref_t/_Remove_cvref_tandtuple_element_tinstead of direct member access with onlyremove_const_t. - Adds comprehensive tests for map/multimap and unordered_map/unordered_multimap deduction with cv-ref qualified pair/tuple types.
- Updates
flat_maptests to verify LWG-4223 with analmost_pairtype that no longer exposesfirst_type/second_typealiases.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| stl/inc/xutility | Updates _Guide_key_t, _Guide_val_t to use remove_cvref_t and simplifies _Guide_pair_t |
| stl/inc/xmemory | Updates _Range_key_type, _Range_mapped_type, _Range_to_alloc_type to use tuple_element_t with remove_cvref_t |
| tests/std/tests/P0433R2_deduction_guides/test.cpp | Adds deduction guide tests for pairs/tuples with cv-ref qualified types |
| tests/std/tests/P0429R9_flat_map/test.cpp | Updates almost_pair and adds flat_map/flat_multimap construction tests for LWG-4223 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6207. I believe the
remove_cvref_tparts should be applied to C++17 mode.