std::strong/weak/partial_order
for pointersSection: 17.11.6 [cmp.alg] Status: C++20 Submitter: Canada Opened: 2019-11-06 Last modified: 2021-02-25
Priority: 0
View other active issues in [cmp.alg].
View all other issues in [cmp.alg].
View all issues with C++20 status.
Discussion:
Addresses CA 178
std::strong_order
, weak_order
, and partial_order
have special cases
for floating point, but are missing special casing for pointers. compare_three_way
and
std::less
have the special casing for pointers.
strong_ordering(E <=> F)
if it is a well-formed expression."
strong_ordering(compare_three_way()(E, F))
if it is a well-formed expression."
Change [cmp.alg] bullet 2.4 from
weak_ordering(E <=> F)
if it is a well-formed expression."
weak_ordering(compare_three_way()(E, F))
if it is a well-formed expression."
partial_ordering(E <=> F)
if it is a well-formed expression."
partial_ordering(compare_three_way()(E, F))
if it is a well-formed expression."
Dietmar Kühl:
Usecompare_three_way
instead of <=>
for the various comparison algorithms.
[2019-11 Status to Ready during Wednesday night issue processing in Belfast.]
Proposed resolution:
This wording is relative to N4835.
Change 17.11.6 [cmp.alg] as indicated:
-1- The name
strong_order
[…]
[…]
(1.4) — Otherwise,
strong_ordering(
if it is a well-formed expression.E <=> Fcompare_three_way()(E, F))[…]
-2- The name
weak_order
[…]
[…]
(2.4) — Otherwise,
weak_ordering(
if it is a well-formed expression.E <=> Fcompare_three_way()(E, F))[…]
-3- The name
partial_order
[…]
[…]
(3.3) — Otherwise,
partial_ordering(
if it is a well-formed expression.E <=> Fcompare_three_way()(E, F))[…]