tmp/tmp_lbqxlpm/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### Concept <a id="concept.common">[[concept.common]]</a>
|
| 2 |
+
|
| 3 |
+
If `T` and `U` can both be explicitly converted to some third type, `C`,
|
| 4 |
+
then `T` and `U` share a *common type*, `C`.
|
| 5 |
+
|
| 6 |
+
[*Note 1*: `C` could be the same as `T`, or `U`, or it could be a
|
| 7 |
+
different type. `C` might not be unique. — *end note*]
|
| 8 |
+
|
| 9 |
+
``` cpp
|
| 10 |
+
template<class T, class U>
|
| 11 |
+
concept common_with =
|
| 12 |
+
same_as<common_type_t<T, U>, common_type_t<U, T>> &&
|
| 13 |
+
requires {
|
| 14 |
+
static_cast<common_type_t<T, U>>(declval<T>());
|
| 15 |
+
static_cast<common_type_t<T, U>>(declval<U>());
|
| 16 |
+
} &&
|
| 17 |
+
common_reference_with<
|
| 18 |
+
add_lvalue_reference_t<const T>,
|
| 19 |
+
add_lvalue_reference_t<const U>> &&
|
| 20 |
+
common_reference_with<
|
| 21 |
+
add_lvalue_reference_t<common_type_t<T, U>>,
|
| 22 |
+
common_reference_t<
|
| 23 |
+
add_lvalue_reference_t<const T>,
|
| 24 |
+
add_lvalue_reference_t<const U>>>;
|
| 25 |
+
```
|
| 26 |
+
|
| 27 |
+
Let `C` be `common_type_t<T, U>`. Let `t1` and `t2` be
|
| 28 |
+
equality-preserving expressions [[concepts.equality]] such that
|
| 29 |
+
`decltype((t1))` and `decltype((t2))` are each `T`, and let `u1` and
|
| 30 |
+
`u2` be equality-preserving expressions such that `decltype((u1))` and
|
| 31 |
+
`decltype((u2))` are each `U`. `T` and `U` model `common_with<T, U>`
|
| 32 |
+
only if:
|
| 33 |
+
|
| 34 |
+
- `C(t1)` equals `C(t2)` if and only if `t1` equals `t2`, and
|
| 35 |
+
- `C(u1)` equals `C(u2)` if and only if `u1` equals `u2`.
|
| 36 |
+
|
| 37 |
+
[*Note 1*: Users can customize the behavior of `common_with` by
|
| 38 |
+
specializing the `common_type` class
|
| 39 |
+
template [[meta.trans.other]]. — *end note*]
|
| 40 |
+
|