Init
This commit is contained in:
184
cppdraft/depr/meta/types.md
Normal file
184
cppdraft/depr/meta/types.md
Normal file
@@ -0,0 +1,184 @@
|
||||
[depr.meta.types]
|
||||
|
||||
# Annex D (normative) Compatibility features [[depr]](./#depr)
|
||||
|
||||
## D.13 Deprecated type traits [depr.meta.types]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/future.tex#L283)
|
||||
|
||||
The header [<type_traits>](meta.type.synop#header:%3ctype_traits%3e "21.3.3 Header <type_traits> synopsis [meta.type.synop]") has the following addition:namespace std {template<class T> struct is_trivial; template<class T> constexpr bool is_trivial_v = is_trivial<T>::value; template<class T> struct is_pod; template<class T> constexpr bool is_pod_v = is_pod<T>::value; template<size_t Len, size_t Align = *default-alignment*> // *see below*struct aligned_storage; template<size_t Len, size_t Align = *default-alignment*> // *see below*using [aligned_storage_t](#lib:aligned_storage_t "D.13 Deprecated type traits [depr.meta.types]") = typename aligned_storage<Len, Align>::type; template<size_t Len, class... Types>struct aligned_union; template<size_t Len, class... Types>using [aligned_union_t](#lib:aligned_union_t "D.13 Deprecated type traits [depr.meta.types]") = typename aligned_union<Len, Types...>::type;}
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/future.tex#L303)
|
||||
|
||||
The behavior of a program that adds specializations for
|
||||
any of the templates defined in this subclause is undefined,
|
||||
unless explicitly permitted by the specification of the corresponding template[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/future.tex#L308)
|
||||
|
||||
A [*trivial class*](#def:class,trivial "D.13 Deprecated type traits [depr.meta.types]") is a class that is trivially copyable and
|
||||
has one or more eligible default constructors, all of which are trivial[.](#3.sentence-1)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
In particular,
|
||||
a trivial class does not have virtual functions or virtual base classes[.](#3.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
A [*trivial type*](#def:type,trivial "D.13 Deprecated type traits [depr.meta.types]") is a scalar type, a trivial class,
|
||||
an array of such a type, or a cv-qualified version of one of these types[.](#3.sentence-3)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/future.tex#L319)
|
||||
|
||||
A [*POD class*](#def:POD_class) is a class that is both a trivial class and a
|
||||
standard-layout class, and has no non-static data members of type non-POD class
|
||||
(or array thereof)[.](#4.sentence-1)
|
||||
|
||||
A [*POD type*](#def:POD_type) is a scalar type, a POD class, an array
|
||||
of such a type, or a cv-qualified version of one of these types[.](#4.sentence-2)
|
||||
|
||||
[ð](#lib:is_trivial)
|
||||
|
||||
`template<class T> struct is_trivial;
|
||||
`
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/future.tex#L332)
|
||||
|
||||
*Preconditions*: remove_all_extents_t<T> shall be a complete type or cv void[.](#5.sentence-1)
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/future.tex#L336)
|
||||
|
||||
*Remarks*: is_trivial<T> is a *Cpp17UnaryTypeTrait* ([[meta.rqmts]](meta.rqmts "21.3.2 Requirements"))
|
||||
with a base characteristic of true_type if T is a trivial type,
|
||||
and false_type otherwise[.](#6.sentence-1)
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/future.tex#L343)
|
||||
|
||||
[*Note [2](#note-2)*:
|
||||
|
||||
It is unspecified
|
||||
whether a closure type ([[expr.prim.lambda.closure]](expr.prim.lambda.closure "7.5.6.2 Closure types")) is a trivial type[.](#7.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[ð](#lib:is_pod)
|
||||
|
||||
`template<class T> struct is_pod;
|
||||
`
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/future.tex#L356)
|
||||
|
||||
*Preconditions*: remove_all_extents_t<T> shall be a complete type or cv void[.](#8.sentence-1)
|
||||
|
||||
[9](#9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/future.tex#L360)
|
||||
|
||||
*Remarks*: is_pod<T> is a [*Cpp17UnaryTypeTrait*](meta.rqmts#:Cpp17UnaryTypeTrait "21.3.2 Requirements [meta.rqmts]") ([[meta.rqmts]](meta.rqmts "21.3.2 Requirements"))
|
||||
with a base characteristic of true_type if T is a POD type,
|
||||
and false_type otherwise[.](#9.sentence-1)
|
||||
|
||||
[10](#10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/future.tex#L367)
|
||||
|
||||
[*Note [3](#note-3)*:
|
||||
|
||||
It is unspecified whether a closure type ([[expr.prim.lambda.closure]](expr.prim.lambda.closure "7.5.6.2 Closure types")) is a POD type[.](#10.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[ð](#lib:aligned_storage)
|
||||
|
||||
`template<size_t Len, size_t Align = default-alignment>
|
||||
struct aligned_storage;
|
||||
`
|
||||
|
||||
[11](#11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/future.tex#L380)
|
||||
|
||||
The value of *default-alignment* is the most
|
||||
stringent alignment requirement for any object type whose size
|
||||
is no greater than Len ([[basic.types]](basic.types "6.9 Types"))[.](#11.sentence-1)
|
||||
|
||||
[12](#12)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/future.tex#L385)
|
||||
|
||||
*Mandates*: Len is not zero[.](#12.sentence-1)
|
||||
|
||||
Align is equal to alignof(T) for some type T or
|
||||
to *default-alignment*[.](#12.sentence-2)
|
||||
|
||||
[13](#13)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/future.tex#L391)
|
||||
|
||||
The member typedef type denotes a trivial standard-layout type
|
||||
suitable for use as uninitialized storage for any object
|
||||
whose size is at most Len and
|
||||
whose alignment is a divisor of Align[.](#13.sentence-1)
|
||||
|
||||
[14](#14)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/future.tex#L397)
|
||||
|
||||
[*Note [4](#note-4)*:
|
||||
|
||||
Uses of aligned_storage<Len, Align>::type can be replaced
|
||||
by an array std::byte[Len] declared with alignas(Align)[.](#14.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[15](#15)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/future.tex#L403)
|
||||
|
||||
[*Note [5](#note-5)*:
|
||||
|
||||
A typical implementation would define aligned_storage as:template<size_t Len, size_t Alignment>struct aligned_storage {typedef struct {alignas(Alignment) unsigned char __data[Len]; } type;};
|
||||
|
||||
â *end note*]
|
||||
|
||||
[ð](#lib:aligned_union)
|
||||
|
||||
`template<size_t Len, class... Types>
|
||||
struct aligned_union;
|
||||
`
|
||||
|
||||
[16](#16)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/future.tex#L425)
|
||||
|
||||
*Mandates*: At least one type is provided[.](#16.sentence-1)
|
||||
|
||||
Each type in the template parameter pack Types is a complete object type[.](#16.sentence-2)
|
||||
|
||||
[17](#17)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/future.tex#L431)
|
||||
|
||||
The member typedef type denotes a trivial standard-layout type
|
||||
suitable for use as uninitialized storage for any object
|
||||
whose type is listed in Types;
|
||||
its size shall be at least Len[.](#17.sentence-1)
|
||||
|
||||
The static member alignment_value is an integral constant of type size_t whose value is the strictest alignment of all types listed in Types[.](#17.sentence-2)
|
||||
Reference in New Issue
Block a user