Skip to content

Latest commit

 

History

History
56 lines (40 loc) · 1.13 KB

File metadata and controls

56 lines (40 loc) · 1.13 KB

parent_of

  • meta[meta header]
  • std::meta[meta namespace]
  • function[meta id-type]
  • cpp26[meta cpp]
namespace std::meta {
  consteval info parent_of(info r);
}
  • info[link info.md]

概要

リフレクションの親スコープのリフレクションを取得する。

戻り値

rが属するスコープのリフレクションを返す。has_parent(r)trueであることが事前条件となる。

例外

has_parent(r)falseの場合、std::meta::exception例外を送出する。

#include <meta>

namespace ns {
  struct S {};
}

int main() {
  static_assert(std::meta::has_parent(^^ns::S));
  static_assert(std::meta::parent_of(^^ns::S) == ^^ns);
}

出力

バージョン

言語

  • C++26

処理系

参照