tmp/tmpzes6o_g2/{from.md → to.md}
RENAMED
|
@@ -8,44 +8,59 @@ transform one type to another following some predefined rule.
|
|
| 8 |
Each of the templates in [[meta.trans]] shall be a
|
| 9 |
*Cpp17TransformationTrait* [[meta.rqmts]].
|
| 10 |
|
| 11 |
#### Const-volatile modifications <a id="meta.trans.cv">[[meta.trans.cv]]</a>
|
| 12 |
|
|
|
|
|
|
|
|
|
|
| 13 |
#### Reference modifications <a id="meta.trans.ref">[[meta.trans.ref]]</a>
|
| 14 |
|
|
|
|
|
|
|
| 15 |
#### Sign modifications <a id="meta.trans.sign">[[meta.trans.sign]]</a>
|
| 16 |
|
|
|
|
|
|
|
|
|
|
| 17 |
#### Array modifications <a id="meta.trans.arr">[[meta.trans.arr]]</a>
|
| 18 |
|
|
|
|
|
|
|
| 19 |
[*Example 1*:
|
| 20 |
|
| 21 |
``` cpp
|
| 22 |
// the following assertions hold:
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
```
|
| 28 |
|
| 29 |
— *end example*]
|
| 30 |
|
| 31 |
[*Example 2*:
|
| 32 |
|
| 33 |
``` cpp
|
| 34 |
// the following assertions hold:
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
```
|
| 40 |
|
| 41 |
— *end example*]
|
| 42 |
|
| 43 |
#### Pointer modifications <a id="meta.trans.ptr">[[meta.trans.ptr]]</a>
|
| 44 |
|
|
|
|
|
|
|
| 45 |
#### Other transformations <a id="meta.trans.other">[[meta.trans.other]]</a>
|
| 46 |
|
|
|
|
|
|
|
|
|
|
| 47 |
[*Note 1*: The compilation of the expression can result in side effects
|
| 48 |
such as the instantiation of class template specializations and function
|
| 49 |
template specializations, the generation of implicitly-defined
|
| 50 |
functions, and so on. Such side effects are not in the “immediate
|
| 51 |
context” and can result in the program being ill-formed. — *end note*]
|
|
@@ -86,13 +101,13 @@ Given types `A` and `B`, let `X` be `remove_reference_t<A>`, let `Y` be
|
|
| 86 |
- Otherwise, `COMMON-REF(A, B)` is ill-formed.
|
| 87 |
|
| 88 |
If any of the types computed above is ill-formed, then
|
| 89 |
`COMMON-REF(A, B)` is ill-formed.
|
| 90 |
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
|
| 95 |
- If `sizeof...(T)` is zero, there shall be no member `type`.
|
| 96 |
- If `sizeof...(T)` is one, let `T0` denote the sole type constituting
|
| 97 |
the pack `T`. The member *typedef-name* `type` shall denote the same
|
| 98 |
type, if any, as `common_type_t<T0, T0>`; otherwise there shall be no
|
|
@@ -123,15 +138,14 @@ as follows:
|
|
| 123 |
constituting `T`. Let `C` denote the same type, if any, as
|
| 124 |
`common_type_t<T1, T2>`. If there is such a type `C`, the member
|
| 125 |
*typedef-name* `type` shall denote the same type, if any, as
|
| 126 |
`common_type_t<C, R...>`. Otherwise, there shall be no member `type`.
|
| 127 |
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
`is_same_v<
|
| 132 |
-
`true`.
|
| 133 |
|
| 134 |
[*Note 3*: Such specializations are needed when only explicit
|
| 135 |
conversions are desired between the template arguments. — *end note*]
|
| 136 |
|
| 137 |
Such a specialization need not have a member named `type`, but if it
|
|
@@ -139,12 +153,12 @@ does, the *qualified-id* `common_type<T1, T2>::type` shall denote a
|
|
| 139 |
cv-unqualified non-reference type to which each of the types `T1` and
|
| 140 |
`T2` is explicitly convertible. Moreover, `common_type_t<T1, T2>` shall
|
| 141 |
denote the same type, if any, as does `common_type_t<T2, T1>`. No
|
| 142 |
diagnostic is required for a violation of this Note’s rules.
|
| 143 |
|
| 144 |
-
|
| 145 |
-
|
| 146 |
follows:
|
| 147 |
|
| 148 |
- If `sizeof...(T)` is zero, there shall be no member `type`.
|
| 149 |
- Otherwise, if `sizeof...(T)` is one, let `T0` denote the sole type in
|
| 150 |
the pack `T`. The member typedef `type` shall denote the same type as
|
|
@@ -170,12 +184,12 @@ follows:
|
|
| 170 |
`common_reference_t<T1, T2>`. Then:
|
| 171 |
- If there is such a type `C`, the member typedef `type` shall denote
|
| 172 |
the same type, if any, as `common_reference_t<C, Rest...>`.
|
| 173 |
- Otherwise, there shall be no member `type`.
|
| 174 |
|
| 175 |
-
|
| 176 |
-
|
| 177 |
`basic_common_reference<T, U, TQual, UQual>` for types `T` and `U` such
|
| 178 |
that `is_same_v<T, decay_t<T>>` and `is_same_v<U, decay_t<U>>` are each
|
| 179 |
`true`.
|
| 180 |
|
| 181 |
[*Note 4*: Such specializations can be used to influence the result of
|
|
|
|
| 8 |
Each of the templates in [[meta.trans]] shall be a
|
| 9 |
*Cpp17TransformationTrait* [[meta.rqmts]].
|
| 10 |
|
| 11 |
#### Const-volatile modifications <a id="meta.trans.cv">[[meta.trans.cv]]</a>
|
| 12 |
|
| 13 |
+
The templates specified in [[meta.trans.cv]] add or remove
|
| 14 |
+
cv-qualifications [[basic.type.qualifier]].
|
| 15 |
+
|
| 16 |
#### Reference modifications <a id="meta.trans.ref">[[meta.trans.ref]]</a>
|
| 17 |
|
| 18 |
+
The templates specified in [[meta.trans.ref]] add or remove references.
|
| 19 |
+
|
| 20 |
#### Sign modifications <a id="meta.trans.sign">[[meta.trans.sign]]</a>
|
| 21 |
|
| 22 |
+
The templates specified in [[meta.trans.sign]] convert an integer type
|
| 23 |
+
to its corresponding signed or unsigned type.
|
| 24 |
+
|
| 25 |
#### Array modifications <a id="meta.trans.arr">[[meta.trans.arr]]</a>
|
| 26 |
|
| 27 |
+
The templates specified in [[meta.trans.arr]] modify array types.
|
| 28 |
+
|
| 29 |
[*Example 1*:
|
| 30 |
|
| 31 |
``` cpp
|
| 32 |
// the following assertions hold:
|
| 33 |
+
static_assert(is_same_v<remove_extent_t<int>, int>);
|
| 34 |
+
static_assert(is_same_v<remove_extent_t<int[2]>, int>);
|
| 35 |
+
static_assert(is_same_v<remove_extent_t<int[2][3]>, int[3]>);
|
| 36 |
+
static_assert(is_same_v<remove_extent_t<int[][3]>, int[3]>);
|
| 37 |
```
|
| 38 |
|
| 39 |
— *end example*]
|
| 40 |
|
| 41 |
[*Example 2*:
|
| 42 |
|
| 43 |
``` cpp
|
| 44 |
// the following assertions hold:
|
| 45 |
+
static_assert(is_same_v<remove_all_extents_t<int>, int>);
|
| 46 |
+
static_assert(is_same_v<remove_all_extents_t<int[2]>, int>);
|
| 47 |
+
static_assert(is_same_v<remove_all_extents_t<int[2][3]>, int>);
|
| 48 |
+
static_assert(is_same_v<remove_all_extents_t<int[][3]>, int>);
|
| 49 |
```
|
| 50 |
|
| 51 |
— *end example*]
|
| 52 |
|
| 53 |
#### Pointer modifications <a id="meta.trans.ptr">[[meta.trans.ptr]]</a>
|
| 54 |
|
| 55 |
+
The templates specified in [[meta.trans.ptr]] add or remove pointers.
|
| 56 |
+
|
| 57 |
#### Other transformations <a id="meta.trans.other">[[meta.trans.other]]</a>
|
| 58 |
|
| 59 |
+
The templates specified in [[meta.trans.other]] perform other
|
| 60 |
+
modifications of a type.
|
| 61 |
+
|
| 62 |
[*Note 1*: The compilation of the expression can result in side effects
|
| 63 |
such as the instantiation of class template specializations and function
|
| 64 |
template specializations, the generation of implicitly-defined
|
| 65 |
functions, and so on. Such side effects are not in the “immediate
|
| 66 |
context” and can result in the program being ill-formed. — *end note*]
|
|
|
|
| 101 |
- Otherwise, `COMMON-REF(A, B)` is ill-formed.
|
| 102 |
|
| 103 |
If any of the types computed above is ill-formed, then
|
| 104 |
`COMMON-REF(A, B)` is ill-formed.
|
| 105 |
|
| 106 |
+
For the `common_type` trait applied to a template parameter pack `T` of
|
| 107 |
+
types, the member `type` shall be either defined or not present as
|
| 108 |
+
follows:
|
| 109 |
|
| 110 |
- If `sizeof...(T)` is zero, there shall be no member `type`.
|
| 111 |
- If `sizeof...(T)` is one, let `T0` denote the sole type constituting
|
| 112 |
the pack `T`. The member *typedef-name* `type` shall denote the same
|
| 113 |
type, if any, as `common_type_t<T0, T0>`; otherwise there shall be no
|
|
|
|
| 138 |
constituting `T`. Let `C` denote the same type, if any, as
|
| 139 |
`common_type_t<T1, T2>`. If there is such a type `C`, the member
|
| 140 |
*typedef-name* `type` shall denote the same type, if any, as
|
| 141 |
`common_type_t<C, R...>`. Otherwise, there shall be no member `type`.
|
| 142 |
|
| 143 |
+
Notwithstanding the provisions of [[meta.rqmts]], and pursuant to
|
| 144 |
+
[[namespace.std]], a program may specialize `common_type<T1, T2>` for
|
| 145 |
+
types `T1` and `T2` such that `is_same_v<T1, decay_t<T1>>` and
|
| 146 |
+
`is_same_v<T2, decay_t<T2>>` are each `true`.
|
|
|
|
| 147 |
|
| 148 |
[*Note 3*: Such specializations are needed when only explicit
|
| 149 |
conversions are desired between the template arguments. — *end note*]
|
| 150 |
|
| 151 |
Such a specialization need not have a member named `type`, but if it
|
|
|
|
| 153 |
cv-unqualified non-reference type to which each of the types `T1` and
|
| 154 |
`T2` is explicitly convertible. Moreover, `common_type_t<T1, T2>` shall
|
| 155 |
denote the same type, if any, as does `common_type_t<T2, T1>`. No
|
| 156 |
diagnostic is required for a violation of this Note’s rules.
|
| 157 |
|
| 158 |
+
For the `common_reference` trait applied to a parameter pack `T` of
|
| 159 |
+
types, the member `type` shall be either defined or not present as
|
| 160 |
follows:
|
| 161 |
|
| 162 |
- If `sizeof...(T)` is zero, there shall be no member `type`.
|
| 163 |
- Otherwise, if `sizeof...(T)` is one, let `T0` denote the sole type in
|
| 164 |
the pack `T`. The member typedef `type` shall denote the same type as
|
|
|
|
| 184 |
`common_reference_t<T1, T2>`. Then:
|
| 185 |
- If there is such a type `C`, the member typedef `type` shall denote
|
| 186 |
the same type, if any, as `common_reference_t<C, Rest...>`.
|
| 187 |
- Otherwise, there shall be no member `type`.
|
| 188 |
|
| 189 |
+
Notwithstanding the provisions of [[meta.rqmts]], and pursuant to
|
| 190 |
+
[[namespace.std]], a program may partially specialize
|
| 191 |
`basic_common_reference<T, U, TQual, UQual>` for types `T` and `U` such
|
| 192 |
that `is_same_v<T, decay_t<T>>` and `is_same_v<U, decay_t<U>>` are each
|
| 193 |
`true`.
|
| 194 |
|
| 195 |
[*Note 4*: Such specializations can be used to influence the result of
|