- meta[meta header]
- std::meta[meta namespace]
- function[meta id-type]
- cpp26[meta cpp]
namespace std::meta {
consteval bool is_annotation(info r);
}- info[link info.md]
リフレクションがアノテーションであるかを判定する。
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());
}- std::meta::annotations_of[link annotations_of.md]
- C++26
- Clang: ??
- GCC: 16 (
-freflectionオプション指定) [mark verified] - Visual C++: ??