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

Section: 23.14.4 [func.invoke] Status: C++17 Submitter: Great Britain Opened: 2016-11-09 Last modified: 2017-07-30

Priority: 3

View other active issues in [func.invoke].

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 23.14.1 [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 23.14.4 [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...>);