◐ Shell
clean mode source ↗

std::meta::template_of - cppreference.com

From cppreference.com

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

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

#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