Spec-Zone.ru › C++

std::meta::has_template_arguments

Defined in header <meta>
consteval bool has_template_arguments( std::meta::info r );
(since C++26)

If r represents an entity produced by substituting template arguments into a function template, variable template, class template, or alias template, returns true. Otherwise returns false.

Parameters

r - a reflection value

Return value

true if r represents an entity instantiated from a template, otherwise false.

Notes

If has_template_arguments(r) is true, the functions std::meta::template_of and std::meta::template_arguments_of return its template and template arguments respectively.

Example

#include <meta>
#include <string>
#include <vector>

static_assert(has_template_arguments(^^std::vector<int>));
static_assert(!has_template_arguments(^^std::string));
static_assert(has_template_arguments(std::meta::dealias(^^std::string)));

int main() {}

See also

is_template
(C++26)
checks if reflected entity is a template
(function)

© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/cpp/meta/has_template_arguments

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API