template< class T >
struct is_implicit_lifetime;
std::is_implicit_lifetime
is a UnaryTypeTrait.
If T
is an implicit-lifetime type, provides the member constant value equal to true. For any other type, value is false.
The behavior is undefined if T is an incomplete type other than an array type or (possibly cv-qualified) void.
If the program adds specializations for std::is_implicit_lifetime
or std::is_implicit_lifetime_v
, the behavior is undefined.
template< class T >
constexpr bool is_implicit_lifetime_v = is_implicit_lifetime<T>::value;
T
is an implicit-lifetime type, false otherwise
// The following types are collectively called implicit-lifetime types: // * scalar types: // * arithmetic types // * enumeration types // * pointer types // * pointer-to-member types // * std::nullptr_t // * implicit-lifetime class types // * is an aggregate whose destructor is not user-provided // * has at least one trivial eligible constructor and a trivial, // non-deleted destructor // * array types // * cv-qualified versions of these types. #include <type_traits> static_assert(std::is_implicit_lifetime_v<int>); // arithmetic type is a scalar type static_assert(std::is_implicit_lifetime_v<const int>); // cv-qualified a scalar type enum E { e }; static_assert(std::is_implicit_lifetime_v<E>); // enumeration type is a scalar type static_assert(std::is_implicit_lifetime_v<int*>); // pointer type is a scalar type static_assert(std::is_implicit_lifetime_v<std::nullptr_t>); // scalar type struct S { int x, y; }; // S is an implicit-lifetime class: an aggregate without user-provided destructor static_assert(std::is_implicit_lifetime_v<S>); static_assert(std::is_implicit_lifetime_v<int S::*>); // pointer-to-member struct X { ~X() = delete; }; // X is not implicit-lifetime class due to deleted destructor static_assert(!std::is_implicit_lifetime_v<X>); static_assert(std::is_implicit_lifetime_v<int[8]>); // array type static_assert(std::is_implicit_lifetime_v<volatile int[8]>); // cv-qualified array type int main() {}[edit] See also
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4