Refactoring around tuple-like, pair-like, and subrange#4983
Merged
StephanTLavavej merged 1 commit intomicrosoft:mainfrom Oct 12, 2024
Merged
Conversation
Effectively mirrors LLVM-85206. In the current standard wording, the "_`pair-like`_ but not `subrange`" pattern is used more often than plain _`pair-like`_. So it's probably worthwhile to carve out the `_Pair_like_non_subrange` concept. `_Tuple_like_non_subrange` seems less worthwhile, but it should be helpful in the constructors of `tuple`. Moreover, with `_Pair_like_non_subrange` carved out, we can put the definitions of `_Pair_like` in C++20 & 23 modes together in `<xutility>`. `_Pair_like_non_subrange` should be also helpful for extracting the key object from pair-like construction argument via `_In_place_key_extract_map` (since C++23). I think this can be done in a future PR. Other changes: Renaming the template parameter of `subrange`'s conversion function to `_PairLike`, making the identifier `_Pair_like in MSVC STL always mean the concept.
f40ce6f to
15e946c
Compare
StephanTLavavej
approved these changes
Oct 3, 2024
StephanTLavavej
approved these changes
Oct 3, 2024
Member
|
This is an awesome simplification, thank you! This makes the code easier to follow, and avoids the hazard of forgetting Question for potential followup, not in this PR - I observe that we have: Lines 2295 to 2300 in faccf00 Now that |
Member
|
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
Member
🍐 🍐 🍐 |
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.
Effectively mirrors LLVM-85206.
In the current standard wording, the "
pair-likebut notsubrange" pattern is used more often than plainpair-like. So it's probably worthwhile to carve out the_Pair_like_non_subrangeconcept._Tuple_like_non_subrangeseems less worthwhile, but it should be helpful in the constructors oftuple.Moreover, with
_Pair_like_non_subrangecarved out, we can put the definitions of_Pair_likein C++20 & 23 modes together in<xutility>._Pair_like_non_subrangeshould be also helpful for extracting the key object from pair-like construction argument via_In_place_key_extract_map(since C++23). I think this can be done in a future PR.Other changes: Renaming the template parameter of
subrange's conversion function to_PairLike, making the identifier_Pair_likein MSVC STL always mean the concept.