Proposal: Allow std::apply and replace base::apply with it

23 views
Skip to first unread message

Peter Kasting

unread,
Sep 9, 2022, 11:52:33 AM9/9/22
to cxx
We currently have one non-test use of base::apply, a backport of C++17's std::apply.

There's nothing special about the base:: implementation (no extra CHECKs or anything).  I propose to eliminate it and call std::apply in the lone caller, and move std::apply to the "allowed" section of our docs.

(Incidentally, I looked at std::invoke too, which has a base::invoke counterpart.  But base::invoke is constexpr, which std::invoke is not in C++17 [it is in C++20], so I think the right thing to do there is to leave it TBD until we have C++20 and then convert.)

PK

K. Moon

unread,
Sep 9, 2022, 12:08:25 PM9/9/22
to Peter Kasting, cxx
SGTM

--
You received this message because you are subscribed to the Google Groups "cxx" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cxx+uns...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/cxx/CAAHOzFCQ0qSCKDuE7WkcibcgLYG8kV1XW9pKcADBmd9v4Dt6%2Bg%40mail.gmail.com.

dan...@chromium.org

unread,
Sep 9, 2022, 12:32:25 PM9/9/22
to Peter Kasting, cxx
On Fri, Sep 9, 2022 at 11:52 AM 'Peter Kasting' via cxx <c...@chromium.org> wrote:
We currently have one non-test use of base::apply, a backport of C++17's std::apply.

There's nothing special about the base:: implementation (no extra CHECKs or anything).  I propose to eliminate it and call std::apply in the lone caller, and move std::apply to the "allowed" section of our docs.

LGTM
 

(Incidentally, I looked at std::invoke too, which has a base::invoke counterpart.  But base::invoke is constexpr, which std::invoke is not in C++17 [it is in C++20], so I think the right thing to do there is to leave it TBD until we have C++20 and then convert.)

Sounds like it should live in cxx20_backports.h then

Daniel Cheng

unread,
Sep 9, 2022, 12:44:08 PM9/9/22
to dan...@chromium.org, Peter Kasting, cxx

Peter Kasting

unread,
Sep 9, 2022, 1:59:58 PM9/9/22
to cxx
Reply all
Reply to author
Forward
0 new messages