38 ->
decltype(comp(*f1, *f2))
40 using ret_t =
decltype(comp(*f1, *f2));
41 static_assert(std::disjunction_v<
42 std::is_same<ret_t, std::strong_ordering>,
43 std::is_same<ret_t, std::weak_ordering>,
44 std::is_same<ret_t, std::partial_ordering>>,
45 "The return type must be a comparison category type.");
47 bool exhaust1 = (f1 == l1);
48 bool exhaust2 = (f2 == l2);
49 for (; !exhaust1 && !exhaust2; exhaust1 = (++f1 == l1), exhaust2 = (++f2 == l2))
50 if (
auto c = comp(*f1, *f2); c != 0)
53 return !exhaust1 ? std::strong_ordering::greater:
54 !exhaust2 ? std::strong_ordering::less:
55 std::strong_ordering::equal;