std::meta::is_complete_type
From cppreference.com
| Defined in header <meta>
|
||
consteval bool is_complete_type( std::meta::info r );
|
(since C++26) | |
Returns true if the reflection r refers to 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
Example
Can be checked out on Compiler Explorer.
Run this code
#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 is a type (function) |