I am writing a sorting algorithm, that takes a comparison function, similar to std::sort:
template <class RandomIt, class Compare>
void sort(RandomIt first, RandomIt last, Compare comp);
It seems to me that the template parameter Compare perfectly matches the Compare named requirement. I am trying to understand how to specify that constraint using C++ 20 concepts, such as std::strict_weak_order and std::equivalence_relation, but I am slightly confused.
If I quote the article on cppreference,
The type
Tsatisfies Compare if The typeTsatisfies BinaryPredicate, and Given
comp, an object of typeTequiv(a, b), an expression equivalent to!comp(a, b) && !comp(b, a)
std::strict_weak_ordering could capture my constraints on comp in the description above, but what about equiv? std::equivalence_relation takes a relation as a first template parameter. What would it be in my sorting function?