namespace std::meta {
consteval bool is_annotation(info r);
}
概要
リフレクションがアノテーションであるかを判定する。
戻り値
rがアノテーションを表す場合にtrueを返す。そうでなければfalseを返す。
例
#include <meta>
struct Tag {};
struct [[=Tag{}]] S {};
consteval bool check() {
auto annots = std::meta::annotations_of(^^S);
return annots.size() == 1 && std::meta::is_annotation(annots[0]);
}
int main() {
static_assert(check());
}
出力
バージョン
言語
- C++26
処理系
- Clang: ??
- GCC: 16 (
-freflectionオプション指定) ✅ - Visual C++: ??