You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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.
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.
This is an awesome simplification, thank you! This makes the code easier to follow, and avoids the hazard of forgetting remove_cv_t with _Is_subrange_v. I especially can't believe we were shadowing _Pair_like - you know how much I loathe that! π»
Question for potential followup, not in this PR - I observe that we have:
Now that _Pair_like is available in both C++20/23, can/should we use it unconditionally here? I tried to look up how uses_allocator_construction_args was specified in C++20 but the machinery is very complicated (even by my standards πΉ) so I'm not entirely sure.
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-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.