This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of Resolved status.

### 2894. The function template `std::apply()` is required to be `constexpr`, but `std::invoke()` isn't

Section: 20.14.5 [func.invoke] Status: Resolved Submitter: Great Britain Opened: 2017-02-03 Last modified: 2020-09-06

Priority: 3

View all other issues in [func.invoke].

View all issues with Resolved status.

Discussion:

Addresses GB 51

The function template `std::apply()` in 20.5.5 [tuple.apply] is required to be `constexpr`, but `std::invoke()` in 20.14.5 [func.invoke] isn't. The most sensible implementation of `apply_impl()` is exactly equivalent to `std::invoke()`, so this requires implementations to have a `constexpr` version of `invoke()` for internal use, and the public API `std::invoke`, which must not be `constexpr` even though it is probably implemented in terms of the internal version.

Proposed change: Add `constexpr` to `std::invoke`.

[2017-02-20, Marshall adds wording]

[Kona 2017-03-01]

We think this needs CWG 1581 to work; accepted as Immediate to resolve NB comment.

Friday: CWG 1581 was not moved in Kona. Status back to Open.

[2017-07 Toronto Tuesday PM issue prioritization]

Priority 3

[2020-01 Resolved by the adoption of P1065 in Cologne.]

Proposed resolution:

This wording is relative to N4640.

1. Modify 20.14.5 [func.invoke] as indicated:

   >     template <class F, class... Args>
   >          constexpr result_of_t<F&&(Args&&...)> invoke(F&& f, Args&&... args);