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

2807. std::invoke should use std::is_nothrow_callable

Section: 22.10.5 [func.invoke] Status: C++17 Submitter: Great Britain Opened: 2016-11-09 Last modified: 2020-09-06

Priority: 3

View all other issues in [func.invoke].

View all issues with C++17 status.

Discussion:

Addresses GB 53

std::invoke can be made trivially noexcept using the new std::is_nothrow_callable trait:

Proposed change:

Add the exception specifier noexcept(is_nothrow_callable_v<F&&(Args&&...)>) to std::invoke.

[Issues Telecon 16-Dec-2016]

Priority 3

[2017-02-28, Daniel comments and provides wording]

The following wording assumes that D0604R0 would be accepted, therefore uses is_nothrow_invocable_v instead of the suggested current trait is_nothrow_callable_v

[Kona 2017-03-01]

Accepted as Immediate to resolve NB comment.

Proposed resolution:

This wording is relative to N4640.

  1. Change 22.10.2 [functional.syn], header <functional> synopsis, as indicated:

    // 20.14.4, invoke
    template <class F, class... Args>
      invoke_result_t<F, Args...>result_of_t<F&&(Args&&...)> invoke(F&& f, Args&&... args) noexcept(is_nothrow_invocable_v<F, Args...>);
    
  2. Change 22.10.5 [func.invoke] as indicated:

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