- meta[meta header]
- std::meta[meta namespace]
- function[meta id-type]
- cpp26[meta cpp]
namespace std::meta {
template <reflection_range R = std::initializer_list<info>>
consteval bool can_substitute(info templ, R&& arguments);
}- info[link info.md]
- reflection_range[link reflection_range.md]
テンプレートにテンプレート引数を置換可能かを判定する。
テンプレートtemplにargumentsを置換した結果が妥当である場合にtrueを返す。そうでなければfalseを返す。
templがテンプレートを表さない場合、またはargumentsの要素がテンプレート引数として使用可能な構成要素を表さない場合、std::meta::exception例外を送出する。
#include <meta>
#include <vector>
int main() {
static_assert(std::meta::can_substitute(^^std::vector, {^^int}));
}- C++26
- Clang: ??
- GCC: 16 (
-freflectionオプション指定) [mark verified] - Visual C++: ??