From Jason Turner

[meta.trans.other]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpa4az2ojc/{from.md → to.md} +24 -38
tmp/tmpa4az2ojc/{from.md → to.md} RENAMED
@@ -1,27 +1,12 @@
1
  #### Other transformations <a id="meta.trans.other">[[meta.trans.other]]</a>
2
 
3
- [*Note 1*: This behavior is similar to the lvalue-to-rvalue
4
- [[conv.lval]], array-to-pointer [[conv.array]], and function-to-pointer
5
- [[conv.func]] conversions applied when an lvalue is used as an rvalue,
6
- but also strips cv-qualifiers from class types in order to more closely
7
- model by-value argument passing. — *end note*]
8
-
9
- [*Note 2*:
10
-
11
- A typical implementation would define `aligned_storage` as:
12
-
13
- ``` cpp
14
- template<size_t Len, size_t Alignment>
15
- struct aligned_storage {
16
- typedef struct {
17
- alignas(Alignment) unsigned char __data[Len];
18
- } type;
19
- };
20
- ```
21
-
22
- — *end note*]
23
 
24
  In addition to being available via inclusion of the `<type_traits>`
25
  header, the templates `unwrap_reference`, `unwrap_ref_decay`,
26
  `unwrap_reference_t`, and `unwrap_ref_decay_t` are available when the
27
  header `<functional>` [[functional.syn]] is included.
@@ -72,11 +57,11 @@ as follows:
72
  `T` be denoted by `T1` and `T2`, respectively, and let `D1` and `D2`
73
  denote the same types as `decay_t<T1>` and `decay_t<T2>`,
74
  respectively.
75
  - If `is_same_v<T1, D1>` is `false` or `is_same_v<T2, D2>` is `false`,
76
  let `C` denote the same type, if any, as `common_type_t<D1, D2>`.
77
- - \[*Note 3*: None of the following will apply if there is a
78
  specialization `common_type<D1, D2>`. — *end note*]
79
  - Otherwise, if
80
  ``` cpp
81
  decay_t<decltype(false ? declval<D1>() : declval<D2>())>
82
  ```
@@ -100,20 +85,19 @@ Note B: Notwithstanding the provisions of [[meta.type.synop]], and
100
  pursuant to [[namespace.std]], a program may specialize
101
  `common_type<T1, T2>` for types `T1` and `T2` such that
102
  `is_same_v<T1, decay_t<T1>>` and `is_same_v<T2, decay_t<T2>>` are each
103
  `true`.
104
 
105
- [*Note 4*: Such specializations are needed when only explicit
106
  conversions are desired between the template arguments. — *end note*]
107
 
108
  Such a specialization need not have a member named `type`, but if it
109
- does, that member shall be a *typedef-name* for an accessible and
110
- unambiguous cv-unqualified non-reference type `C` to which each of the
111
- types `T1` and `T2` is explicitly convertible. Moreover,
112
- `common_type_t<T1, T2>` shall denote the same type, if any, as does
113
- `common_type_t<T2, T1>`. No diagnostic is required for a violation of
114
- this Note’s rules.
115
 
116
  Note C: For the `common_reference` trait applied to a parameter pack `T`
117
  of types, the member `type` shall be either defined or not present as
118
  follows:
119
 
@@ -121,12 +105,14 @@ follows:
121
  - Otherwise, if `sizeof...(T)` is one, let `T0` denote the sole type in
122
  the pack `T`. The member typedef `type` shall denote the same type as
123
  `T0`.
124
  - Otherwise, if `sizeof...(T)` is two, let `T1` and `T2` denote the two
125
  types in the pack `T`. Then
126
- - If `T1` and `T2` are reference types and `COMMON-REF(T1, T2)` is
127
- well-formed, then the member typedef `type` denotes that type.
 
 
128
  - Otherwise, if
129
  `basic_common_reference<remove_cvref_t<T1>, remove_cvref_t<T2>,
130
  {}XREF({}T1), XREF(T2)>::type` is well-formed, then the member
131
  typedef `type` denotes that type.
132
  - Otherwise, if `COND-RES(T1, T2)` is well-formed, then the member
@@ -143,23 +129,23 @@ follows:
143
  - Otherwise, there shall be no member `type`.
144
 
145
  Note D: Notwithstanding the provisions of [[meta.type.synop]], and
146
  pursuant to [[namespace.std]], a program may partially specialize
147
  `basic_common_reference<T, U, TQual, UQual>` for types `T` and `U` such
148
- that `is_same_v<T, decay_t<T>{>}` and `is_same_v<U, decay_t<U>{>}` are
149
- each `true`.
150
 
151
- [*Note 5*: Such specializations can be used to influence the result of
152
  `common_reference`, and are needed when only explicit conversions are
153
  desired between the template arguments. — *end note*]
154
 
155
  Such a specialization need not have a member named `type`, but if it
156
- does, that member shall be a *typedef-name* for an accessible and
157
- unambiguous type `C` to which each of the types `TQual<T>` and
158
- `UQual<U>` is convertible. Moreover,
159
- `basic_common_reference<T, U, TQual, UQual>::type` shall denote the same
160
- type, if any, as does
161
  `basic_common_reference<U, T, UQual, TQual>::type`. No diagnostic is
162
  required for a violation of these rules.
163
 
164
  [*Example 2*:
165
 
 
1
  #### Other transformations <a id="meta.trans.other">[[meta.trans.other]]</a>
2
 
3
+ [*Note 1*: The compilation of the expression can result in side effects
4
+ such as the instantiation of class template specializations and function
5
+ template specializations, the generation of implicitly-defined
6
+ functions, and so on. Such side effects are not in the “immediate
7
+ context” and can result in the program being ill-formed. — *end note*]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
  In addition to being available via inclusion of the `<type_traits>`
10
  header, the templates `unwrap_reference`, `unwrap_ref_decay`,
11
  `unwrap_reference_t`, and `unwrap_ref_decay_t` are available when the
12
  header `<functional>` [[functional.syn]] is included.
 
57
  `T` be denoted by `T1` and `T2`, respectively, and let `D1` and `D2`
58
  denote the same types as `decay_t<T1>` and `decay_t<T2>`,
59
  respectively.
60
  - If `is_same_v<T1, D1>` is `false` or `is_same_v<T2, D2>` is `false`,
61
  let `C` denote the same type, if any, as `common_type_t<D1, D2>`.
62
+ - \[*Note 2*: None of the following will apply if there is a
63
  specialization `common_type<D1, D2>`. — *end note*]
64
  - Otherwise, if
65
  ``` cpp
66
  decay_t<decltype(false ? declval<D1>() : declval<D2>())>
67
  ```
 
85
  pursuant to [[namespace.std]], a program may specialize
86
  `common_type<T1, T2>` for types `T1` and `T2` such that
87
  `is_same_v<T1, decay_t<T1>>` and `is_same_v<T2, decay_t<T2>>` are each
88
  `true`.
89
 
90
+ [*Note 3*: Such specializations are needed when only explicit
91
  conversions are desired between the template arguments. — *end note*]
92
 
93
  Such a specialization need not have a member named `type`, but if it
94
+ does, the *qualified-id* `common_type<T1, T2>::type` shall denote a
95
+ cv-unqualified non-reference type to which each of the types `T1` and
96
+ `T2` is explicitly convertible. Moreover, `common_type_t<T1, T2>` shall
97
+ denote the same type, if any, as does `common_type_t<T2, T1>`. No
98
+ diagnostic is required for a violation of this Note’s rules.
 
99
 
100
  Note C: For the `common_reference` trait applied to a parameter pack `T`
101
  of types, the member `type` shall be either defined or not present as
102
  follows:
103
 
 
105
  - Otherwise, if `sizeof...(T)` is one, let `T0` denote the sole type in
106
  the pack `T`. The member typedef `type` shall denote the same type as
107
  `T0`.
108
  - Otherwise, if `sizeof...(T)` is two, let `T1` and `T2` denote the two
109
  types in the pack `T`. Then
110
+ - Let `R` be `COMMON-REF(T1, T2)`. If `T1` and `T2` are reference
111
+ types, `R` is well-formed, and
112
+ `is_convertible_v<add_pointer_t<T1>, add_pointer_t<R>> && is_convertible_v<add_poin{}ter_t<T2>, add_pointer_t<R>>`
113
+ is `true`, then the member typedef `type` denotes `R`.
114
  - Otherwise, if
115
  `basic_common_reference<remove_cvref_t<T1>, remove_cvref_t<T2>,
116
  {}XREF({}T1), XREF(T2)>::type` is well-formed, then the member
117
  typedef `type` denotes that type.
118
  - Otherwise, if `COND-RES(T1, T2)` is well-formed, then the member
 
129
  - Otherwise, there shall be no member `type`.
130
 
131
  Note D: Notwithstanding the provisions of [[meta.type.synop]], and
132
  pursuant to [[namespace.std]], a program may partially specialize
133
  `basic_common_reference<T, U, TQual, UQual>` for types `T` and `U` such
134
+ that `is_same_v<T, decay_t<T>>` and `is_same_v<U, decay_t<U>>` are each
135
+ `true`.
136
 
137
+ [*Note 4*: Such specializations can be used to influence the result of
138
  `common_reference`, and are needed when only explicit conversions are
139
  desired between the template arguments. — *end note*]
140
 
141
  Such a specialization need not have a member named `type`, but if it
142
+ does, the *qualified-id*
143
+ `basic_common_reference<T, U, TQual, UQual>::type` shall denote a type
144
+ to which each of the types `TQual<T>` and `UQual<U>` is convertible.
145
+ Moreover, `basic_common_reference<T, U, TQual, UQual>::type` shall
146
+ denote the same type, if any, as does
147
  `basic_common_reference<U, T, UQual, TQual>::type`. No diagnostic is
148
  required for a violation of these rules.
149
 
150
  [*Example 2*:
151