From Jason Turner

[tuple.rel]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp32zh4lql/{from.md → to.md} +17 -45
tmp/tmp32zh4lql/{from.md → to.md} RENAMED
@@ -1,15 +1,15 @@
1
- #### Relational operators <a id="tuple.rel">[[tuple.rel]]</a>
2
 
3
  ``` cpp
4
  template<class... TTypes, class... UTypes>
5
  constexpr bool operator==(const tuple<TTypes...>& t, const tuple<UTypes...>& u);
6
  ```
7
 
8
- *Requires:* For all `i`, where `0 <= i` and `i < sizeof...(TTypes)`,
9
  `get<i>(t) == get<i>(u)` is a valid expression returning a type that is
10
- convertible to `bool`. `sizeof...(TTypes)` `==` `sizeof...(UTypes)`.
11
 
12
  *Returns:* `true` if `get<i>(t) == get<i>(u)` for all `i`, otherwise
13
  `false`. For any two zero-length tuples `e` and `f`, `e == f` returns
14
  `true`.
15
 
@@ -17,55 +17,27 @@ convertible to `bool`. `sizeof...(TTypes)` `==` `sizeof...(UTypes)`.
17
  zeroth index upwards. No comparisons or element accesses are performed
18
  after the first equality comparison that evaluates to `false`.
19
 
20
  ``` cpp
21
  template<class... TTypes, class... UTypes>
22
- constexpr bool operator<(const tuple<TTypes...>& t, const tuple<UTypes...>& u);
 
23
  ```
24
 
25
- *Requires:* For all `i`, where `0 <= i` and `i < sizeof...(TTypes)`,
26
- both `get<i>(t) < get<i>(u)` and `get<i>(u) < get<i>(t)` are valid
27
- expressions returning types that are convertible to `bool`.
28
- `sizeof...(TTypes)` `==` `sizeof...(UTypes)`.
29
-
30
- *Returns:* The result of a lexicographical comparison between `t` and
31
- `u`. The result is defined as:
32
- `(bool)(get<0>(t) < get<0>(u)) || (!(bool)(get<0>(u) < get<0>(t)) && t`ₜₐᵢₗ` < u`ₜₐᵢₗ`)`,
33
- where `r`ₜₐᵢₗ for some tuple `r` is a tuple containing all but the first
34
- element of `r`. For any two zero-length tuples `e` and `f`, `e < f`
35
- returns `false`.
36
-
37
- ``` cpp
38
- template<class... TTypes, class... UTypes>
39
- constexpr bool operator!=(const tuple<TTypes...>& t, const tuple<UTypes...>& u);
40
- ```
41
-
42
- *Returns:* `!(t == u)`.
43
-
44
- ``` cpp
45
- template<class... TTypes, class... UTypes>
46
- constexpr bool operator>(const tuple<TTypes...>& t, const tuple<UTypes...>& u);
47
- ```
48
-
49
- *Returns:* `u < t`.
50
-
51
- ``` cpp
52
- template<class... TTypes, class... UTypes>
53
- constexpr bool operator<=(const tuple<TTypes...>& t, const tuple<UTypes...>& u);
54
- ```
55
-
56
- *Returns:* `!(u < t)`.
57
 
58
  ``` cpp
59
- template<class... TTypes, class... UTypes>
60
- constexpr bool operator>=(const tuple<TTypes...>& t, const tuple<UTypes...>& u);
61
  ```
62
 
63
- *Returns:* `!(t < u)`.
 
64
 
65
- [*Note 1*: The above definitions for comparison functions do not
66
- require `tₜₐᵢₗ` (or `uₜₐᵢₗ`) to be constructed. It may not even be
67
- possible, as `t` and `u` are not required to be copy constructible.
68
- Also, all comparison functions are short circuited; they do not perform
69
- element accesses beyond what is required to determine the result of the
70
- comparison. — *end note*]
71
 
 
1
+ ### Relational operators <a id="tuple.rel">[[tuple.rel]]</a>
2
 
3
  ``` cpp
4
  template<class... TTypes, class... UTypes>
5
  constexpr bool operator==(const tuple<TTypes...>& t, const tuple<UTypes...>& u);
6
  ```
7
 
8
+ *Mandates:* For all `i`, where 0 `i` < `sizeof...(TTypes)`,
9
  `get<i>(t) == get<i>(u)` is a valid expression returning a type that is
10
+ convertible to `bool`. `sizeof...(TTypes)` equals `sizeof...(UTypes)`.
11
 
12
  *Returns:* `true` if `get<i>(t) == get<i>(u)` for all `i`, otherwise
13
  `false`. For any two zero-length tuples `e` and `f`, `e == f` returns
14
  `true`.
15
 
 
17
  zeroth index upwards. No comparisons or element accesses are performed
18
  after the first equality comparison that evaluates to `false`.
19
 
20
  ``` cpp
21
  template<class... TTypes, class... UTypes>
22
+ constexpr common_comparison_category_t<synth-three-way-result<TTypes, UTypes>...>
23
+ operator<=>(const tuple<TTypes...>& t, const tuple<UTypes...>& u);
24
  ```
25
 
26
+ *Effects:* Performs a lexicographical comparison between `t` and `u`.
27
+ For any two zero-length tuples `t` and `u`, `t <=> u` returns
28
+ `strong_ordering::equal`. Otherwise, equivalent to:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
  ``` cpp
31
+ if (auto c = synth-three-way(get<0>(t), get<0>(u)); c != 0) return c;
32
+ return $t_tail$ <=> $u_tail$;
33
  ```
34
 
35
+ where `r_tail` for some tuple `r` is a tuple containing all but the
36
+ first element of `r`.
37
 
38
+ [*Note 1*: The above definition does not require `tₜₐᵢₗ` (or `uₜₐᵢₗ`)
39
+ to be constructed. It may not even be possible, as `t` and `u` are not
40
+ required to be copy constructible. Also, all comparison functions are
41
+ short circuited; they do not perform element accesses beyond what is
42
+ required to determine the result of the comparison. — *end note*]
 
43