std::meta::is_complete_type
Defined in header <meta> | ||
|---|---|---|
consteval bool is_complete_type( std::meta::info r ); | (since C++26) |
Determines if the reflection r represents a complete type.
Formally, returns true if std::meta::is_type(r) is true and there is some point in the evaluation context from which the type represented by std::meta::dealias(r) is not an incomplete type. Otherwise, returns false.
Parameters
| r | - | a reflection to examine |
Return value
true if r represents a complete type, false otherwise
Notes
An enumeration type is complete if its underlying type is known. To check if its list of enumerators is completely defined, see 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));
Example
#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() {}
See also
|
(C++26) | checks if reflection represents a type (function) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/cpp/meta/is_complete_type