From Jason Turner

[depr.meta.types]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpeyna7y_u/{from.md → to.md} +40 -13
tmp/tmpeyna7y_u/{from.md → to.md} RENAMED
@@ -2,43 +2,70 @@
2
 
3
  The header `<type_traits>` has the following addition:
4
 
5
  ``` cpp
6
  namespace std {
 
 
7
  template<class T> struct is_pod;
8
  template<class T> constexpr bool is_pod_v = is_pod<T>::value;
9
  template<size_t Len, size_t Align = default-alignment> // see below
10
  struct aligned_storage;
11
  template<size_t Len, size_t Align = default-alignment> // see below
12
- using aligned_storage_t = typename aligned_storage<Len, Align>::type;
13
  template<size_t Len, class... Types>
14
  struct aligned_union;
15
  template<size_t Len, class... Types>
16
- using aligned_union_t = typename aligned_union<Len, Types...>::type;
17
  }
18
  ```
19
 
20
  The behavior of a program that adds specializations for any of the
21
  templates defined in this subclause is undefined, unless explicitly
22
  permitted by the specification of the corresponding template.
23
 
24
- ``` cpp
25
- template<class T> struct is_pod;
26
- ```
27
 
28
- *Requires:* `remove_all_extents_t<T>` shall be a complete type or cv
29
- `void`.
30
 
31
- `is_pod<T>` is a *Cpp17UnaryTypeTrait*[[meta.rqmts]] with a base
32
- characteristic of `true_type` if `T` is a POD type, and `false_type`
33
- otherwise. A POD class is a class that is both a trivial class and a
 
34
  standard-layout class, and has no non-static data members of type
35
- non-POD class (or array thereof). A POD type is a scalar type, a POD
36
  class, an array of such a type, or a cv-qualified version of one of
37
  these types.
38
 
 
 
 
 
 
 
 
 
 
 
 
39
  [*Note 1*: It is unspecified whether a closure
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  type [[expr.prim.lambda.closure]] is a POD type. — *end note*]
41
 
42
  ``` cpp
43
  template<size_t Len, size_t Align = default-alignment>
44
  struct aligned_storage;
@@ -53,15 +80,15 @@ type `T` or to *default-alignment*.
53
 
54
  The member typedef `type` denotes a trivial standard-layout type
55
  suitable for use as uninitialized storage for any object whose size is
56
  at most `Len` and whose alignment is a divisor of `Align`.
57
 
58
- [*Note 2*: Uses of `aligned_storage<Len, Align>::type` can be replaced
59
  by an array `std::byte[Len]` declared with
60
  `alignas(Align)`. — *end note*]
61
 
62
- [*Note 3*:
63
 
64
  A typical implementation would define `aligned_storage` as:
65
 
66
  ``` cpp
67
  template<size_t Len, size_t Alignment>
 
2
 
3
  The header `<type_traits>` has the following addition:
4
 
5
  ``` cpp
6
  namespace std {
7
+ template<class T> struct is_trivial;
8
+ template<class T> constexpr bool is_trivial_v = is_trivial<T>::value;
9
  template<class T> struct is_pod;
10
  template<class T> constexpr bool is_pod_v = is_pod<T>::value;
11
  template<size_t Len, size_t Align = default-alignment> // see below
12
  struct aligned_storage;
13
  template<size_t Len, size_t Align = default-alignment> // see below
14
+ using aligned_storage_t = aligned_storage<Len, Align>::type;
15
  template<size_t Len, class... Types>
16
  struct aligned_union;
17
  template<size_t Len, class... Types>
18
+ using aligned_union_t = aligned_union<Len, Types...>::type;
19
  }
20
  ```
21
 
22
  The behavior of a program that adds specializations for any of the
23
  templates defined in this subclause is undefined, unless explicitly
24
  permitted by the specification of the corresponding template.
25
 
26
+ A *trivial class* is a class that is trivially copyable and has one or
27
+ more eligible default constructors, all of which are trivial.
 
28
 
29
+ [*Note 1*: In particular, a trivial class does not have virtual
30
+ functions or virtual base classes. — *end note*]
31
 
32
+ A *trivial type* is a scalar type, a trivial class, an array of such a
33
+ type, or a cv-qualified version of one of these types.
34
+
35
+ A *POD class* is a class that is both a trivial class and a
36
  standard-layout class, and has no non-static data members of type
37
+ non-POD class (or array thereof). A *POD type* is a scalar type, a POD
38
  class, an array of such a type, or a cv-qualified version of one of
39
  these types.
40
 
41
+ ``` cpp
42
+ template<class T> struct is_trivial;
43
+ ```
44
+
45
+ *Preconditions:* `remove_all_extents_t<T>` shall be a complete type or
46
+ cv `void`.
47
+
48
+ *Remarks:* `is_trivial<T>` is a *Cpp17UnaryTypeTrait*[[meta.rqmts]] with
49
+ a base characteristic of `true_type` if `T` is a trivial type, and
50
+ `false_type` otherwise.
51
+
52
  [*Note 1*: It is unspecified whether a closure
53
+ type [[expr.prim.lambda.closure]] is a trivial type. — *end note*]
54
+
55
+ ``` cpp
56
+ template<class T> struct is_pod;
57
+ ```
58
+
59
+ *Preconditions:* `remove_all_extents_t<T>` shall be a complete type or
60
+ cv `void`.
61
+
62
+ *Remarks:* `is_pod<T>` is a *Cpp17UnaryTypeTrait*[[meta.rqmts]] with a
63
+ base characteristic of `true_type` if `T` is a POD type, and
64
+ `false_type` otherwise.
65
+
66
+ [*Note 2*: It is unspecified whether a closure
67
  type [[expr.prim.lambda.closure]] is a POD type. — *end note*]
68
 
69
  ``` cpp
70
  template<size_t Len, size_t Align = default-alignment>
71
  struct aligned_storage;
 
80
 
81
  The member typedef `type` denotes a trivial standard-layout type
82
  suitable for use as uninitialized storage for any object whose size is
83
  at most `Len` and whose alignment is a divisor of `Align`.
84
 
85
+ [*Note 3*: Uses of `aligned_storage<Len, Align>::type` can be replaced
86
  by an array `std::byte[Len]` declared with
87
  `alignas(Align)`. — *end note*]
88
 
89
+ [*Note 4*:
90
 
91
  A typical implementation would define `aligned_storage` as:
92
 
93
  ``` cpp
94
  template<size_t Len, size_t Alignment>