The following code works well with gcc:
struct S {
int i, j;
auto operator<(const S& s) const {
return i < s.i;
};
};
std::vector<S> v;
std::make_heap(v.begin(), v.end());
But when I switch to C++20's range algorithm:
std::ranges::make_heap(v);
source>:14:27: error: no match for call to '(const std::ranges::__make_heap_fn) (std::vector<S>&)'
14 | std::ranges::make_heap(v);
|
^
It seems struct S doesn't satisfy the requirements of the ranges::make_heap, but I don't know what exactly it is, can someone help?