Skip to content

Latest commit

 

History

History
62 lines (44 loc) · 1.2 KB

File metadata and controls

62 lines (44 loc) · 1.2 KB

is_annotation

  • 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

処理系

関連項目

参照