Namespaces
Variants

std::meta::template_of

cppreference.net에서
 
 
 
반영 라이브러리
 
반영 타입 및 쿼리
반영 쿼리
반영 레이아웃 쿼리
타입 속성
타입 속성 쿼리
 
헤더에 정의됨<meta>
consteval bool template_of( std::meta::info r );
(C++26부터)

함수 템플릿, 변수 템플릿, 클래스 템플릿 또는 별칭 템플릿에서 인스턴스화된 엔티티를 나타내는 반영 r이 주어지면, 해당 템플릿의 반영을 반환합니다.

매개변수

r - 반영 값

반환값

r이 나타내는 함수, 변수, 클래스 또는 타입 별칭이 인스턴스화된 템플릿.

예외

std::meta::exception을 던집니다. 단, std::meta::has_template_arguments(r)이 true인 경우는 예외입니다 (즉, r이 템플릿에서 인스턴스화된 엔티티를 나타내지 않는 경우).

예제

#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() {}

참고 항목

Template:cpp/meta/dsc is template
반영된 엔티티가 템플릿에 템플릿 인수를 대입하여 생성되었는지 확인합니다
(함수)