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

履歴 編集

function
<meta>

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

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

概要

関数テンプレートであるかを判定する。

戻り値

rが関数テンプレートを表す場合にtrueを返す。

#include <meta>

// 関数テンプレート
template <class T>
T add(T a, T b) { return a + b; }

// 通常の関数
int multiply(int a, int b) { return a * b; }

int main() {
  static_assert(std::meta::is_function_template(^^add));
  static_assert(!std::meta::is_function_template(^^multiply));
  static_assert(!std::meta::is_function_template(^^int));
}

出力

バージョン

言語

  • C++26

処理系

参照