libstdc++: Change [cmp.alg] assertions to constraints
authorJonathan Wakely <jwakely@redhat.com>
Mon, 14 Jun 2021 11:25:43 +0000 (12:25 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Mon, 14 Jun 2021 13:04:45 +0000 (14:04 +0100)
commite2c79b968ff95421c31a5a9a1b80b11321fe70d2
treedacfd8c42bfc427196f773c6952a30eda8507dde
parenta893b26f7311fe65b604f12a8fa5d5d64f5454e2
libstdc++: Change [cmp.alg] assertions to constraints

This moves the same_as<decay_t<_Tp>, decay_t<_Up>> checks from the
[cmp.alg] function bodies into their constraints.

Also add a test for the compare_xxx_order_fallback algorithms.

libstdc++-v3/ChangeLog:

* libsupc++/compare (__decayed_same_as): New helper concept.
(strong_order, weak_order, partial_order): Constrain with new
concept instead of using static_assert.
(compare_strong_order_fallback, compare_weak_order_fallback)
(compare_partial_order_fallback): Likewise. Do not deduce return
types. Remove redundant if-constexpr checks.
* testsuite/18_support/comparisons/algorithms/fallback.cc: New test.
libstdc++-v3/libsupc++/compare
libstdc++-v3/testsuite/18_support/comparisons/algorithms/fallback.cc [new file with mode: 0644]