std::meta::has_template_arguments
From cppreference.com
| 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.
Contents
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
Run this code
#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
(C++26) |
checks if reflected entity is a template (function) |