tmp/tmpki281plf/{from.md → to.md}
RENAMED
|
@@ -3,11 +3,19 @@
|
|
| 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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
}
|
| 10 |
```
|
| 11 |
|
| 12 |
The behavior of a program that adds specializations for any of the
|
| 13 |
templates defined in this subclause is undefined, unless explicitly
|
|
@@ -29,5 +37,54 @@ class, an array of such a type, or a cv-qualified version of one of
|
|
| 29 |
these types.
|
| 30 |
|
| 31 |
[*Note 1*: It is unspecified whether a closure
|
| 32 |
type [[expr.prim.lambda.closure]] is a POD type. — *end note*]
|
| 33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|
|
|
|
| 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;
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
The value of *default-alignment* is the most stringent alignment
|
| 48 |
+
requirement for any object type whose size is no greater than `Len`
|
| 49 |
+
[[basic.types]].
|
| 50 |
+
|
| 51 |
+
*Mandates:* `Len` is not zero. `Align` is equal to `alignof(T)` for some
|
| 52 |
+
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>
|
| 68 |
+
struct aligned_storage {
|
| 69 |
+
typedef struct {
|
| 70 |
+
alignas(Alignment) unsigned char __data[Len];
|
| 71 |
+
} type;
|
| 72 |
+
};
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
— *end note*]
|
| 76 |
+
|
| 77 |
+
``` cpp
|
| 78 |
+
template<size_t Len, class... Types>
|
| 79 |
+
struct aligned_union;
|
| 80 |
+
```
|
| 81 |
+
|
| 82 |
+
*Mandates:* At least one type is provided. Each type in the template
|
| 83 |
+
parameter pack `Types` is a complete object type.
|
| 84 |
+
|
| 85 |
+
The member typedef `type` denotes a trivial standard-layout type
|
| 86 |
+
suitable for use as uninitialized storage for any object whose type is
|
| 87 |
+
listed in `Types`; its size shall be at least `Len`. The static member
|
| 88 |
+
`alignment_value` is an integral constant of type `size_t` whose value
|
| 89 |
+
is the strictest alignment of all types listed in `Types`.
|
| 90 |
+
|