2
メンバー関数がC++で呼び出し可能でないかどうかを確認する方法17std :: is_nothrow_invocable with member function
クラスC
には、名前がf
のメンバー関数があり、引数としてint
を呼び出すことができないかどうかを知りたいと思っています。
#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 >);
}
最初の解決策は正しいです、私は2番目のものの私の元の投稿にエラーメッセージを追加します。 –
第2版が修正されました。 'decltype'がありません。 – Jarod42
パーフェクト、ありがとう! –