Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

frederick-vs-ja
Copy link
Contributor

@frederick-vs-ja frederick-vs-ja commented Sep 26, 2024

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.

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.
@CaseyCarter CaseyCarter added the enhancement Something can be improved label Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Something can be improved
Projects
Status: Initial Review
Development

Successfully merging this pull request may close these issues.

2 participants