最終更新日時(UTC):
が更新

履歴 編集

function
<meta>

std::meta::is_base_of_type(C++26)

namespace std::meta {
  consteval bool is_base_of_type(info type_base, info type_derived);
}

概要

型が別の型の基底クラスであるかを判定する。std::is_base_ofに対応する。

戻り値

type_basetype_derivedの基底クラスである場合にtrueを返す。

例外

type_baseまたはtype_derivedが型を表さない場合、std::meta::exception例外を送出する。

#include <meta>

struct Base {};
struct Derived : Base {};

int main() {
  static_assert(std::meta::is_base_of_type(^^Base, ^^Derived));
  static_assert(!std::meta::is_base_of_type(^^Derived, ^^Base));
}

出力

バージョン

言語

  • C++26

処理系

関連項目

参照