std::meta::template_of
From cppreference.com
| Defined in header <meta>
|
||
consteval bool template_of( std::meta::info r );
|
(since C++26) | |
Given a reflection r that represents an entity instantiated from a function template, variable template, class template, or alias template, returns a reflection of the template.
Parameters
| r | - | a reflection value |
Return value
The template from which the function, variable, class, or type alias represented by r is instantiated.
Exceptions
Throws std::meta::exception unless std::meta::has_template_arguments(r) is true (i.e. r represents an entity instantiated from a template).
Example
Run this code
#include <meta>
#include <string>
#include <vector>
static_assert(template_of(^^std::vector<int>) == ^^std::vector);
static_assert(!has_template_arguments(^^std::string));
static_assert(template_of(std::meta::dealias(^^std::string)) == ^^std::basic_string);
int main() {}
See also
Template:cpp/meta/dsc is template(C++26) |
checks if reflected entity is produced by substituting template arguments into a template (function) |