list/sort: remove the forwarding comparison operator

This commit is contained in:
Danny Robson 2019-09-09 10:24:28 +10:00
parent ce03a24f88
commit 455e917070

View File

@ -14,15 +14,11 @@
#include <utility>
namespace cruft::list {
/// A simple tuple-style linked list node.
template <typename ValueT>
struct node {
node *next;
ValueT data;
bool operator< (node const &rhs) const
{
return data < rhs.data;
}
};
@ -61,7 +57,7 @@ namespace cruft::list {
return first;
auto extract = [&] () {
auto &target = *first < *middle ? first : middle;
auto &target = first->data < middle->data ? first : middle;
auto res = target;
target = target->next;
return res;
@ -113,7 +109,7 @@ namespace cruft::list {
auto b = head->next;
while (b) {
if (*b < *a)
if (b->data < a->data)
return false;
a = a->next;