From Jason Turner

[diff.cpp20.concepts]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpkbyae3dz/{from.md → to.md} +24 -0
tmp/tmpkbyae3dz/{from.md → to.md} RENAMED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### [[concepts]]: concepts library <a id="diff.cpp20.concepts">[[diff.cpp20.concepts]]</a>
2
+
3
+ **Change:** Replace `common_reference_with` in
4
+ `three_way_comparable_with`, `equality_comparable_with`, and
5
+ `totally_ordered_with` with an exposition-only concept. **Rationale:**
6
+ Allow uncopyable, but movable, types to model these concepts. **Effect
7
+ on original feature:** Valid C++20 code relying on subsumption with
8
+ `common_reference_with` may fail to compile in this revision of C++. For
9
+ example:
10
+
11
+ ``` cpp
12
+ template<class T, class U>
13
+ requires equality_comparable_with<T, U>
14
+ bool attempted_equals(const T&, const U& u); // previously selected overload
15
+
16
+ template<class T, class U>
17
+ requires common_reference_with<const remove_reference_t<T>&, const remove_reference_t<U>&>
18
+ bool attempted_equals(const T& t, const U& u); // ambiguous overload; previously
19
+ // rejected by partial ordering
20
+ bool test(shared_ptr<int> p) {
21
+ return attempted_equals(p, nullptr); // ill-formed; previously well-formed
22
+ }
23
+ ```
24
+