namespace std::meta {
consteval bool is_nothrow_swappable_type(info type);
}
概要
例外を送出せずにswap可能型であるかを判定する。std::is_nothrow_swappableに対応する。
戻り値
typeが表す型が例外を送出せずにswap可能型である場合にtrueを返す。
例外
typeが型を表さない場合、std::meta::exception例外を送出する。
例
#include <meta>
struct Safe {
friend void swap(Safe&, Safe&) noexcept {}
};
struct Throwing {
friend void swap(Throwing&, Throwing&) noexcept(false) {}
};
int main() {
static_assert(std::meta::is_nothrow_swappable_type(^^int));
static_assert(std::meta::is_nothrow_swappable_type(^^Safe));
static_assert(!std::meta::is_nothrow_swappable_type(^^Throwing));
}
出力
バージョン
言語
- C++26
処理系
- Clang: ??
- GCC: 16 (
-freflectionオプション指定) ✅ - Visual C++: ??