std::meta::is_complete_type
cppreference.net에서
| 헤더에 정의됨 <meta>
|
||
consteval bool is_complete_type( std::meta::info r );
|
(C++26부터) | |
리플렉션 r가 나타내는 것이 완전한 타입.
공식적으로, true 만약 std::meta::is_type(r) 가 true 이고, 평가 컨텍스트에서 std::meta::dealias(r) 가 나타내는 타입이 불완전한 타입이 아닌 지점이 존재하면 그렇습니다. 그렇지 않으면, false.
매개변수
| r | - | 검사할 리플렉션 |
반환값
true r가 완전한 타입을 나타내면, false 그렇지 않으면
참고
하나의 열거형 타입는 기본 타입이 알려져 있으면 완전한 타입입니다. 열거자의 목록이 완전히 정의되었는지 확인하려면 std::meta::is_enumerable_type.
enum E : int;
static_assert(std::meta::is_complete_type(^^E));
static_assert(!std::meta::is_enumerable_type(^^E));
enum E : int { e };
static_assert(std::meta::is_enumerable_type(^^E));
예제
이 코드 실행
#include <meta>
struct A; // incomplete type
struct B {}; // complete type
static_assert(std::meta::is_complete_type(^^A) == false);
static_assert(std::meta::is_complete_type(^^B) == true);
template <typename>
struct C; // incomplete class template
template <>
struct C<int> {}; // complete explicit template specialization
template <>
struct C<long>; // incomplete explicit template specialization
static_assert(std::meta::is_complete_type(^^C<long>) == false);
static_assert(std::meta::is_complete_type(^^C<char>) == false);
static_assert(std::meta::is_complete_type(^^C<int>) == true);
int main() {}
함께 보기
(C++26) |
리플렉션이 타입을 나타내는지 확인합니다 (함수) |