Page MenuHomePhabricator

[libc++][P2321R2] Add specializations of basic_common_reference and common_type for pair
ClosedPublic

Authored by philnik on Jan 17 2022, 11:55 AM.

Details

Summary

Add specializations of basic_common_reference and common_type for pair

Diff Detail

Event Timeline

philnik requested review of this revision.Jan 17 2022, 11:55 AM
philnik created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptJan 17 2022, 11:55 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript

Looks good to me, modulo some nits and scope-creep followup ideas.

libcxx/include/__utility/pair.h
323

Let's make this easy to compare to lines 320-321 at a glance.

333–336

Let's keep the deduction guide for pair located right after class pair; both because it's more tightly "related" to the class than these partial specializations, and so that the library additions remain in chronological order (C++03, then C++17 deduction guide, then C++2b specializations).

libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/common_reference.compile.pass.cpp
204–205

Let's pick one style and be consistent here: either one-line all of these like lines 202, 203, etc; or two-line them all like lines 204-205, 206-207, etc.

libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp
363–376

Should this say common_type_t instead of common_reference_t? or what's this line doing here? Ditto below.
And/or, should this line be moved to common_reference.compile.pass.cpp?

Orthogonally, and probably in a separate NFC commit, can common_type.pass.cpp be renamed to common_type.compile.pass.cpp (and eliminate its main)?

philnik updated this revision to Diff 400633.Jan 17 2022, 1:37 PM
philnik marked 4 inline comments as done.
  • Address comments
libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp
363–376

I already thought about making this .compile.pass.cpp. That's why I put the static_asserts originally below the main in D116538. I'll make a follow-up PR.

Mordante accepted this revision.Feb 1 2022, 11:19 AM

LGTM, modulo one small issue. Please rebase to make sure the CI becomes green.

libcxx/include/__utility/pair.h
392

Please update the synopsis in <utility>.

This revision is now accepted and ready to land.Feb 1 2022, 11:19 AM
philnik updated this revision to Diff 405060.Feb 1 2022, 12:39 PM
philnik marked an inline comment as done.
  • Rebased
  • Add synopsis