-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactoring around tuple-like
, pair-like
, and subrange
#4983
Refactoring around tuple-like
, pair-like
, and subrange
#4983
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
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 |
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
🍐 🍐 🍐 |
Effectively mirrors LLVM-85206.
In the current standard wording, the "
pair-like
but notsubrange
" pattern is used more often than plainpair-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 oftuple
.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.