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(C++26) |
반영된 엔티티가 템플릿에 템플릿 인수를 대입하여 생성되었는지 확인합니다 (함수) |