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

履歴 編集

function
<meta>

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

namespace std::meta {
  consteval info constant_of(info r);
}

概要

リフレクションが表す定数のリフレクションを取得する。

戻り値

rが定数式を表す場合、その定数値のリフレクションを返す。

例外

rのスプライスが有効なスプライス式でない場合、std::meta::exception例外を送出する。

#include <meta>

constexpr int value = 42;

int main() {
  constexpr auto c = std::meta::constant_of(^^value);
  static_assert(std::meta::extract<int>(c) == 42);
}

出力

バージョン

言語

  • C++26

処理系

参照