[libc++] Clean up pair's constructors and assignment operators
authorLouis Dionne <ldionne.2@gmail.com>
Tue, 7 Feb 2023 23:21:08 +0000 (15:21 -0800)
committerLouis Dionne <ldionne.2@gmail.com>
Fri, 28 Apr 2023 19:16:15 +0000 (15:16 -0400)
commit9e35fc07f4001c5803069013bcfc266ad99da637
tree544389eeaa606c304ac621186ed7fbe176d9e7bc
parent4b80a8c72d3d0dba4ee2469471dfccb7e257b319
[libc++] Clean up pair's constructors and assignment operators

This patch makes std::pair's constructors and assignment operators
closer to conforming in C++23. The only missing bit I am aware of
now is `reference_constructs_from_temporary_v` checks, which we
don't have the tools for yet.

This patch also refactors a long-standing non-standard extension where
we'd provide constructors for tuple-like types in all standard modes. The
criteria for being a tuple-like type are different from pair-like types
as introduced recently in the standard, leading to a lot of complexity
when trying to implement recent papers that touch the pair constructors.

After this patch, the pre-C++23 extension is provided in a self-contained
block so that we can easily deprecate and eventually remove the extension
in future releases.

Differential Revision: https://reviews.llvm.org/D143914
libcxx/include/__tuple/sfinae_helpers.h
libcxx/include/__utility/pair.h
libcxx/include/utility
libcxx/test/std/utilities/utility/pairs/pairs.pair/assign.pair_like_rv.pass.cpp [new file with mode: 0644]
libcxx/test/std/utilities/utility/pairs/pairs.pair/assign.pair_like_rv_const.pass.cpp [new file with mode: 0644]
libcxx/test/std/utilities/utility/pairs/pairs.pair/ctor.pair_like.pass.cpp [new file with mode: 0644]