From Jason Turner

[cmp.concept]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpl6pidult/{from.md → to.md} +12 -7
tmp/tmpl6pidult/{from.md → to.md} RENAMED
@@ -1,6 +1,6 @@
1
- ### Concept `three_way_comparable` <a id="cmp.concept">[[cmp.concept]]</a>
2
 
3
  ``` cpp
4
  template<class T, class Cat>
5
  concept compares-as = // exposition only
6
  same_as<common_comparison_category_t<T, Cat>, Cat>;
@@ -56,32 +56,37 @@ and `Cat` model `three_way_comparable<T, Cat>` only if:
56
  ``` cpp
57
  template<class T, class U, class Cat = partial_ordering>
58
  concept three_way_comparable_with =
59
  three_way_comparable<T, Cat> &&
60
  three_way_comparable<U, Cat> &&
61
- common_reference_with<const remove_reference_t<T>&, const remove_reference_t<U>&> &&
62
  three_way_comparable<
63
  common_reference_t<const remove_reference_t<T>&, const remove_reference_t<U>&>, Cat> &&
64
  weakly-equality-comparable-with<T, U> &&
65
  partially-ordered-with<T, U> &&
66
  requires(const remove_reference_t<T>& t, const remove_reference_t<U>& u) {
67
  { t <=> u } -> compares-as<Cat>;
68
  { u <=> t } -> compares-as<Cat>;
69
  };
70
  ```
71
 
72
- Let `t` and `u` be lvalues of types `const remove_reference_t<T>` and
73
- `const remove_reference_t<U>`, respectively. Let `C` be
 
 
 
74
  `common_reference_t<const remove_reference_t<T>&, const remove_reference_t<U>&>`.
75
- `T`, `U`, and `Cat` model `three_way_comparable_with<T, U, Cat>` only
76
- if:
 
77
 
78
  - `t <=> u` and `u <=> t` have the same domain,
79
  - `((t <=> u) <=> 0)` and `(0 <=> (u <=> t))` are equal,
80
  - `(t <=> u == 0) == bool(t == u)` is `true`,
81
  - `(t <=> u != 0) == bool(t != u)` is `true`,
82
- - `Cat(t <=> u) == Cat(C(t) <=> C(u))` is `true`,
 
83
  - `(t <=> u < 0) == bool(t < u)` is `true`,
84
  - `(t <=> u > 0) == bool(t > u)` is `true`,
85
  - `(t <=> u <= 0) == bool(t <= u)` is `true`,
86
  - `(t <=> u >= 0) == bool(t >= u)` is `true`, and
87
  - if `Cat` is convertible to `strong_ordering`, `T` and `U` model
 
1
+ ### Concept <a id="cmp.concept">[[cmp.concept]]</a>
2
 
3
  ``` cpp
4
  template<class T, class Cat>
5
  concept compares-as = // exposition only
6
  same_as<common_comparison_category_t<T, Cat>, Cat>;
 
56
  ``` cpp
57
  template<class T, class U, class Cat = partial_ordering>
58
  concept three_way_comparable_with =
59
  three_way_comparable<T, Cat> &&
60
  three_way_comparable<U, Cat> &&
61
+ comparison-common-type-with<T, U> &&
62
  three_way_comparable<
63
  common_reference_t<const remove_reference_t<T>&, const remove_reference_t<U>&>, Cat> &&
64
  weakly-equality-comparable-with<T, U> &&
65
  partially-ordered-with<T, U> &&
66
  requires(const remove_reference_t<T>& t, const remove_reference_t<U>& u) {
67
  { t <=> u } -> compares-as<Cat>;
68
  { u <=> t } -> compares-as<Cat>;
69
  };
70
  ```
71
 
72
+ Let `t` and `t2` be lvalues denoting distinct equal objects of types
73
+ `const remove_reference_t<T>` and `remove_cvref_t<T>`, respectively, and
74
+ let `u` and `u2` be lvalues denoting distinct equal objects of types
75
+ `const remove_reference_t<U>` and `remove_cvref_t<U>`, respectively. Let
76
+ `C` be
77
  `common_reference_t<const remove_reference_t<T>&, const remove_reference_t<U>&>`.
78
+ Let `CONVERT_TO_LVALUE<C>(E)` be defined as in
79
+ [[concepts.compare.general]]. `T`, `U`, and `Cat` model
80
+ `three_way_comparable_with<T, U, Cat>` only if:
81
 
82
  - `t <=> u` and `u <=> t` have the same domain,
83
  - `((t <=> u) <=> 0)` and `(0 <=> (u <=> t))` are equal,
84
  - `(t <=> u == 0) == bool(t == u)` is `true`,
85
  - `(t <=> u != 0) == bool(t != u)` is `true`,
86
+ - `Cat(t <=> u) == Cat(CONVERT_TO_LVALUE<C>(t2) <=>
87
+ CONVERT_TO_LVALUE<C>(u2))` is `true`,
88
  - `(t <=> u < 0) == bool(t < u)` is `true`,
89
  - `(t <=> u > 0) == bool(t > u)` is `true`,
90
  - `(t <=> u <= 0) == bool(t <= u)` is `true`,
91
  - `(t <=> u >= 0) == bool(t >= u)` is `true`, and
92
  - if `Cat` is convertible to `strong_ordering`, `T` and `U` model