Namespaces
Variants

std::meta::is_implicit_lifetime_type

From cppreference.com
< cpp | meta
 
 
 
Reflection library
 
Reflection types and queries
Type properties
Type property queries
 
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

checks if reflected type is a scalar type
(function) [edit]
checks if reflected type is an array type
(function) [edit]
checks if reflected type is an aggregate type
(function) [edit]
implicitly creates objects in given storage with the object representation reused
(function template) [edit]
checks if a type is an implicit-lifetime type
(class template) [edit]
Morty Proxy This is a proxified and sanitized view of the page, visit original site.