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

履歴 編集

function
<meta>

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

namespace std::meta {
  consteval std::vector<info> parameters_of(info r);
}

概要

関数の仮引数のリフレクションを取得する。

戻り値

rが関数を表す場合、その仮引数のリフレクションを宣言順に格納したstd::vectorオブジェクトを返す。rが関数型を表す場合、パラメータ型リスト中の型のリフレクションを返す。

例外

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

#include <meta>
#include <print>

void process(int id, double value, const char* name) {}

int main() {
  template for (constexpr auto p : std::define_static_array(std::meta::parameters_of(^^process))) {
    std::println("{}: {}",
      std::meta::identifier_of(p),
      std::meta::display_string_of(std::meta::type_of(p)));
  }
}

出力

id: int
value: double
name: const char*

バージョン

言語

  • C++26

処理系

関連項目

参照