Title
[fund.ts] apply does not work with member pointers
Status
open
Section
[tuple.apply]
Submitter
Zhihao Yuan

Created on 2014-07-08.00:00:00 last changed 89 months ago

Messages

Date: 2015-03-22.19:14:56

Proposed resolution:

This wording is relative to N4081 in regard to fundamental-ts changes.

  1. Edit §3.2.2 [tuple.apply] paragraph 2:

    template <class F, class Tuple>
    constexpr decltype(auto) apply(F&& f, Tuple&& t);
    

    -2- Effects: Given the exposition only function

    template <class F, class Tuple, size_t... I>
    constexpr decltype(auto) apply_impl(  // exposition only
        F&& f, Tuple&& t, index_sequence<I...>) {
      return INVOKE(std::forward<F>(f)(, std::get<I>(std::forward<Tuple>(t))...);
    }
    

    […]

Date: 2015-03-22.19:14:56

[ 2015-02, Cologne ]

DK: We should use the new std::invoke.
TK: Is this a defect?
AM: std::invoke goes into C++17, and this is a defect against a TS based on C++14. We can change this later, but now leave it as INVOKE.
GR: The TS lets you have Editor's Notes, so leave a note to make that change for C++17.

[…]

GR: I can't see how we can assume this is part of the design. I cannot believe it was ever intended for this design to exclude function pointers.
AM: I can give you the exact evolution: We had "apply" as an example explaining the usefulness of index_sequence. Then someone looked at it and said, "why isn't this in the Standard". NJ to VV: Why are you against useful steps? We are trying to converge on a consistent standard across multiple documents. The alternative is to reopen this in a later discussion.
VV: All I said is that this is not defect, whether or not people like it.
AM: So you'd be fine with the issue, but not as a DR?
Straw poll: Who's happy to make this tentatively ready as a DR against the Fundamentals TS? Lots of agreement, no opposition, 3 neutrals

Date: 2014-07-08.00:00:00

Addresses: fund.ts

The definition of apply present in §3.2.2 [tuple.apply] prevents this function template to be used with pointer to members type passed as the first argument.

Effects:

[…]

return std::forward<F>(f)(std::get<I>(std::forward<Tuple>(t))...);

This makes this utility inconsistent with other standard library components and limits its usability.

We propose to define its functionally in terms of INVOKE.

History
Date User Action Args
2017-07-30 20:10:41adminsetstatus: wp -> open
2015-05-22 18:31:21adminsetstatus: ready -> wp
2015-03-22 19:14:56adminsetmessages: + msg7248
2015-03-22 19:14:56adminsetstatus: new -> ready
2014-10-05 14:13:26adminsetmessages: + msg7097
2014-07-08 00:00:00admincreate