namespace std::meta {
template <reflection_range R = std::initializer_list<info>>
consteval bool is_nothrow_invocable_r_type(info type_result, info type, R&& type_args);
}
概要
例外を送出せずに呼び出し可能で戻り値が指定型に変換可能かを判定する。std::is_nothrow_invocable_rに対応する。
戻り値
typeがtype_argsで例外を送出せずに呼び出し可能で、戻り値がtype_resultに変換可能な場合にtrueを返す。
例外
type_result、type、またはtype_argsの各要素が型を表さない場合、std::meta::exception例外を送出する。
例
#include <meta>
int f(double) noexcept { return 0; }
int g(double) { return 0; } // noexceptでない
int main() {
static_assert(std::meta::is_nothrow_invocable_r_type(^^int, ^^decltype(f), {^^double}));
static_assert(!std::meta::is_nothrow_invocable_r_type(^^int, ^^decltype(g), {^^double}));
}
出力
バージョン
言語
- C++26
処理系
- Clang: ??
- GCC: 16 (
-freflectionオプション指定) ✅ - Visual C++: ??