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