apply
does not work with member pointersSection: 3.2.2 [fund.ts::tuple.apply] Status: TS Submitter: Zhihao Yuan Opened: 2014-07-08 Last modified: 2017-07-30
Priority: 0
View all issues with TS status.
Discussion:
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 ofINVOKE
.
[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.
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.Proposed resolution:
This wording is relative to N4081 in regard to fundamental-ts changes.
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))...); }[…]