Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::is_implicit_lifetime

      From cppreference.com
      <cpp‎ |types
       
       
      Metaprogramming library
      Type traits
      Type categories
      (C++11)
      (C++11)(DR*)
      (C++11)
      (C++11)
      (C++11)
      (C++11)
      (C++11)
      (C++11) 
      Type properties
      (C++11)
      (C++11)
      (C++14)
      is_implicit_lifetime
      (C++23)
      (C++11)(deprecated in C++26)
      (C++11)(until C++20*)
      (C++11)(deprecated in C++20)
      (C++11)
      Type trait constants
      Metafunctions
      (C++17)
      Supported operations
      Relationships and property queries
      Type modifications
      Type transformations
      (C++11)(deprecated in C++23)
      (C++11)(deprecated in C++23)
      (C++11)
      (C++11)(until C++20*)(C++17)

      Compile-time rational arithmetic
      Compile-time integer sequences
       
      Defined in header<type_traits>
      template<class T>
      struct is_implicit_lifetime;
      (since C++23)

      std::is_implicit_lifetime is aUnaryTypeTrait.

      IfT is animplicit-lifetime type, provides the member constantvalue equal totrue. For any other type,value isfalse.

      The behavior is undefined ifT is an incomplete type other than an array type or (possibly cv-qualified)void.

      If the program adds specializations forstd::is_implicit_lifetime orstd::is_implicit_lifetime_v, the behavior is undefined.

      Contents

      [edit]Template parameters

      T - a type to check

      [edit]Helper variable template

      template<class T>
      constexprbool is_implicit_lifetime_v= is_implicit_lifetime<T>::value;
      (since C++23)
      [edit]

      Inherited fromstd::integral_constant

      Member constants

      value
      [static]
      true ifT is an implicit-lifetime type,false otherwise
      (public static member constant)

      Member functions

      operator bool
      converts the object tobool, returnsvalue
      (public member function)
      operator()
      (C++14)
      returnsvalue
      (public member function)

      Member types

      Type Definition
      value_typebool
      typestd::integral_constant<bool, value>

      [edit]Notes

      Feature-test macroValueStdFeature
      __cpp_lib_is_implicit_lifetime202302L(C++23)std::is_implicit_lifetime

      [edit]Example

      Run this code
      // 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 typestatic_assert(std::is_implicit_lifetime_v<constint>);// cv-qualified a scalar type enum E{ e};static_assert(std::is_implicit_lifetime_v<E>);// enumeration type is a scalar typestatic_assert(std::is_implicit_lifetime_v<int*>);// pointer type is a scalar typestatic_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 destructorstatic_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 destructorstatic_assert(!std::is_implicit_lifetime_v<X>); static_assert(std::is_implicit_lifetime_v<int[8]>);// array typestatic_assert(std::is_implicit_lifetime_v<volatileint[8]>);// cv-qualified array type int main(){}

      [edit]See also

      (C++11)
      checks if a type is a scalar type
      (class template)[edit]
      (C++11)
      checks if a type is an array type
      (class template)[edit]
      checks if a type is an aggregate type
      (class template)[edit]
      implicitly creates objects in given storage with the object representation reused
      (function template)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/types/is_implicit_lifetime&oldid=176508"

      [8]ページ先頭

      ©2009-2025 Movatter.jp