Files
2025-10-25 03:02:53 +03:00

30 lines
1.7 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[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 "18Concepts 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.4Concept 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.5Concept 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*]