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