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

1.7 KiB

[diff.cpp20.concepts]

Annex C (informative) Compatibility [diff]

C.2 C++ and ISO C++ 2020 [diff.cpp20]

C.2.8 [concepts]: concepts library [diff.cpp20.concepts]

1

#

Affected subclauses: [cmp.concept], [concept.equalitycomparable], and [concept.totallyordered]

Change: Replace common_reference_with in three_way_comparable_with,equality_comparable_with, and totally_ordered_with with an exposition-only concept.

Rationale: Allow uncopyable, but movable, types to model these concepts.

Effect on original feature: Valid C++ 2020 code relying on subsumption with common_reference_with may fail to compile in this revision of C++.

[Example 1: template<class T, class U>requires equality_comparable_with<T, U>bool attempted_equals(const T&, const U& u); // previously selected overloadtemplate<class T, class U>requires common_reference_with<const remove_reference_t&, const remove_reference_t&>bool attempted_equals(const T& t, const U& u); // ambiguous overload; previously// rejected by partial orderingbool test(shared_ptr p) {return attempted_equals(p, nullptr); // ill-formed; previously well-formed} — end example]