compare_partial_order_fallback requires F < ESection: 17.12.6 [cmp.alg] Status: C++23 Submitter: Stephan T. Lavavej Opened: 2020-07-18 Last modified: 2023-11-22
Priority: 0
View other active issues in [cmp.alg].
View all other issues in [cmp.alg].
View all issues with C++23 status.
Discussion:
compare_partial_order_fallback uses three expressions, but requires only two. The decayed types
of E and F are required to be identical, but variations in constness might make a difference.
[2020-07-26; Reflector prioritization]
Set priority to 0 and status to Tentatively Ready after seven votes in favour during reflector discussions.
[2020-11-09 Approved In November virtual meeting. Status changed: Tentatively Ready → WP.]
Proposed resolution:
This wording is relative to N4861.
Modify 17.12.6 [cmp.alg] as indicated:
-6- The name
compare_partial_order_fallbackdenotes a customization point object (16.3.3.3.5 [customization.point.object]). Given subexpressionsEandF, the expressioncompare_partial_order_fallback(E, F)is expression-equivalent ( [defns.expression-equivalent]) to:
(6.1) — If the decayed types of
EandFdiffer,compare_partial_order_fallback(E, F)is ill-formed.(6.2) — Otherwise,
partial_order(E, F)if it is a well-formed expression.(6.3) — Otherwise, if the expressions
E == F,andE < F, andF < Eare allbothwell-formed and convertible tobool,E == F ? partial_ordering::equivalent : E < F ? partial_ordering::less : F < E ? partial_ordering::greater : partial_ordering::unorderedexcept that
EandFare evaluated only once.(6.4) — Otherwise,
compare_partial_order_fallback(E, F)is ill-formed.