30 lines
1.7 KiB
Markdown
30 lines
1.7 KiB
Markdown
[diff.cpp20.concepts]
|
||
|
||
# Annex C (informative) Compatibility [[diff]](./#diff)
|
||
|
||
## C.2 C++ and ISO C++ 2020 [[diff.cpp20]](diff.cpp20#concepts)
|
||
|
||
### C.2.8 [[concepts]](concepts "18 Concepts library"): concepts library [diff.cpp20.concepts]
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/compatibility.tex#L630)
|
||
|
||
**Affected subclauses:** [[cmp.concept]](cmp.concept), [[concept.equalitycomparable]](concept.equalitycomparable), and [[concept.totallyordered]](concept.totallyordered)
|
||
|
||
|
||
**Change:** Replace common_reference_with in three_way_comparable_with,equality_comparable_with, and totally_ordered_with with an exposition-only concept[.](#1.sentence-1)
|
||
|
||
|
||
|
||
|
||
**Rationale:** Allow uncopyable, but movable, types to model these concepts[.](#1.sentence-2)
|
||
|
||
|
||
|
||
|
||
**Effect on original feature:** Valid C++ 2020 code relying on subsumption
|
||
with common_reference_with may fail to compile in this revision of C++[.](#1.sentence-3)
|
||
|
||
[*Example [1](#example-1)*: template<class T, class U>requires [equality_comparable_with](concept.equalitycomparable#concept:equality_comparable_with "18.5.4 Concept equality_comparable [concept.equalitycomparable]")<T, U>bool attempted_equals(const T&, const U& u); // previously selected overloadtemplate<class T, class U>requires [common_reference_with](concept.commonref#concept:common_reference_with "18.4.5 Concept common_reference_with [concept.commonref]")<const remove_reference_t<T>&, const remove_reference_t<U>&>bool attempted_equals(const T& t, const U& u); // ambiguous overload; previously// rejected by partial orderingbool test(shared_ptr<int> p) {return attempted_equals(p, nullptr); // ill-formed; previously well-formed} â *end example*]
|