Heapsort first builds a heap and then uses it to sort the list. If you want final order to be non-decreasing, then the heap must be "largest first" and vice versa. So, current API is broken: you must provide an std::greater if you want non-decreasing order when you normally would provide an std::less
Fix it with an on-the-fly lambda?