std::is_nothrow_invocable with member function

Viewed 1685

How can I check if a member function is nothrow callable in C++17?

I know my class C has a member function with name f and want to know if it is nothrow callable with an int as argument.

#include <type_traits>

struct C{
    void f(int){}
};

int main(){
    // How to use is_nothrow_invocable_v???
    static_assert(std::is_nothrow_invocable_v< &C::f, int >);
}
1 Answers
Related