概要
型が別の型に例外を送出せずに変換可能かを判定する。std::is_nothrow_convertibleに対応する。
戻り値
type_srcがtype_dstに例外を送出せずに変換可能な場合にtrueを返す。
例外
type_srcまたはtype_dstが型を表さない場合、std::meta::exception例外を送出する。
例
#include <meta>
struct A {};
struct B {
B(const A&) noexcept {}
};
struct C {
C(const A&) noexcept(false) {}
};
int main() {
static_assert(std::meta::is_nothrow_convertible_type(^^int, ^^double));
static_assert(std::meta::is_nothrow_convertible_type(^^A, ^^B));
static_assert(!std::meta::is_nothrow_convertible_type(^^A, ^^C));
}
出力
バージョン
言語
- C++26
処理系
- Clang: ??
- GCC: 16 (
-freflectionオプション指定) ✅ - Visual C++: ??