@@ -1009,26 +1009,24 @@ struct inplace_vector
10091009
10101010 constexpr friend auto operator <=>(const inplace_vector &x,
10111011 const inplace_vector &y)
1012- requires (!std::three_way_comparable<T> && std::equality_comparable<T> &&
1012+ requires (std::equality_comparable<T> &&
10131013 beman::details::inplace_vector::lessthan_comparable<T>)
10141014 {
1015- const auto sz = std::min (x.size (), y.size ());
1016- for (std::size_t i = 0 ; i < sz; ++i) {
1017- if (x[i] < y[i])
1018- return std::strong_ordering::less;
1019- if (y[i] < x[i])
1020- return std::strong_ordering::greater;
1015+ if constexpr (std::three_way_comparable<T>) {
1016+ return std::lexicographical_compare_three_way (x.begin (), x.end (),
1017+ y.begin (), y.end ());
1018+ } else {
1019+ const auto sz = std::min (x.size (), y.size ());
1020+ for (std::size_t i = 0 ; i < sz; ++i) {
1021+ if (x[i] < y[i])
1022+ return std::strong_ordering::less;
1023+ if (y[i] < x[i])
1024+ return std::strong_ordering::greater;
1025+ // [container.opt.reqmts] < must be total ordering relationship
1026+ }
1027+
1028+ return x.size () <=> y.size ();
10211029 }
1022-
1023- return x.size () <=> y.size ();
1024- }
1025-
1026- constexpr friend auto operator <=>(const inplace_vector &x,
1027- const inplace_vector &y)
1028- requires (std::three_way_comparable<T>)
1029- {
1030- return std::lexicographical_compare_three_way (x.begin (), x.end (), y.begin (),
1031- y.end ());
10321030 }
10331031};
10341032
0 commit comments