Refactoring around tuple-like, pair-like, and subrange by frederick-vs-ja · Pull Request #4983 · microsoft/STL (original) (raw)

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.