std::meta::is_implicit_lifetime_type
Defined in header <meta> | ||
|---|---|---|
consteval bool is_implicit_lifetime_type( std::meta::info r ); | (since C++26) |
Returns true if r represents an implicit-lifetime type. Otherwise returns false.
Parameters
| r | - | a reflection value |
Return value
true if r represents an implicit-lifetime type; otherwise false.
Exceptions
Throws std::meta::exception if r does not represent a type or type alias.
Example
#include <cstddef>
#include <meta>
enum E { e };
struct S
{
int x, y;
};
struct X
{
X() {}
~X() = delete;
};
static_assert
(""
and is_implicit_lifetime_type(^^int) // arithmetic type is a scalar type
and is_implicit_lifetime_type(^^const int) // cv-qualified scalar type
and is_implicit_lifetime_type(^^E) // enumeration type is a scalar type
and is_implicit_lifetime_type(^^int*) // pointer type is a scalar type
and is_implicit_lifetime_type(^^std::nullptr_t) // scalar type
// S is an implicit-lifetime class: an aggregate without user-provided destructor
and is_implicit_lifetime_type(^^S)
and is_implicit_lifetime_type(^^int S::*) // pointer-to-member
// X is not implicit-lifetime class due to deleted destructor
and not is_implicit_lifetime_type(^^X)
and is_implicit_lifetime_type(^^int[8]) // array type
and is_implicit_lifetime_type(^^volatile int[8]) // cv-qualified array type
);
int main() {}
See also
|
(C++26) | checks if reflected type is a scalar type (function) |
|
(C++26) | checks if reflected type is an array type (function) |
|
(C++26) | checks if reflected type is an aggregate type (function) |
|
(C++23) | implicitly creates objects in given storage with the object representation reused (function template) |
|
(C++23) | checks if a type is an implicit-lifetime type (class template) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/cpp/meta/is_implicit_lifetime_type