From 99da022775b4fffeae77431bfc54f3d7e9df43b4 Mon Sep 17 00:00:00 2001
From: Max Kellermann <mk@cm4all.com>
Date: Wed, 3 Apr 2024 18:14:01 +0200
Subject: [PATCH] util/IntrusiveSortedList: remove unused class

---
 src/util/IntrusiveSortedList.hxx | 41 -----------------------------
 test/util/TestIntrusiveList.cxx  | 45 --------------------------------
 2 files changed, 86 deletions(-)
 delete mode 100644 src/util/IntrusiveSortedList.hxx

diff --git a/src/util/IntrusiveSortedList.hxx b/src/util/IntrusiveSortedList.hxx
deleted file mode 100644
index 4cef8c099..000000000
--- a/src/util/IntrusiveSortedList.hxx
+++ /dev/null
@@ -1,41 +0,0 @@
-// SPDX-License-Identifier: BSD-2-Clause
-// author: Max Kellermann <max.kellermann@gmail.com>
-
-#pragma once
-
-#include "IntrusiveList.hxx"
-
-#include <algorithm> // for std::find_if()
-
-/**
- * A variant of #IntrusiveList which is sorted automatically.  There
- * are obvious scalability problems with this approach, so use with
- * care.
- */
-template<typename T, typename Compare=typename T::Compare,
-	 typename HookTraits=IntrusiveListBaseHookTraits<T>,
-	 IntrusiveListOptions options=IntrusiveListOptions{}>
-class IntrusiveSortedList
-	: public IntrusiveList<T, HookTraits, options>
-{
-	using Base = IntrusiveList<T, HookTraits, options>;
-
-	[[no_unique_address]]
-	Compare compare;
-
-public:
-	constexpr IntrusiveSortedList() noexcept = default;
-	IntrusiveSortedList(IntrusiveSortedList &&src) noexcept = default;
-
-	using typename Base::reference;
-	using Base::begin;
-	using Base::end;
-
-	void insert(reference item) noexcept {
-		auto position = std::find_if(begin(), end(), [this, &item](const auto &other){
-			return !compare(other, item);
-		});
-
-		Base::insert(position, item);
-	}
-};
diff --git a/test/util/TestIntrusiveList.cxx b/test/util/TestIntrusiveList.cxx
index 7fe52b320..ddd1b8bf4 100644
--- a/test/util/TestIntrusiveList.cxx
+++ b/test/util/TestIntrusiveList.cxx
@@ -279,48 +279,3 @@ TEST(IntrusiveList, Sort)
 	ASSERT_EQ(&*std::next(list.begin(), 1), &items[2]);
 	ASSERT_EQ(&*std::next(list.begin(), 2), &items[4]);
 }
-
-#include "util/IntrusiveSortedList.hxx"
-
-TEST(IntrusiveSortedList, Basic)
-{
-	using Item = CharItem<IntrusiveHookMode::NORMAL>;
-
-	struct Compare {
-		constexpr bool operator()(const Item &a, const Item &b) noexcept {
-			return a.ch < b.ch;
-		}
-	};
-
-	Item items[]{'z', 'a', 'b', 'q', 'b', 'c', 't', 'm', 'y'};
-
-	IntrusiveSortedList<Item, Compare> list;
-	ASSERT_EQ(ToString(list, list.begin(), 2), "__");
-
-	list.insert(items[0]);
-	ASSERT_EQ(ToString(list, list.begin(), 3), "z_z");
-
-	list.insert(items[1]);
-	ASSERT_EQ(ToString(list, list.begin(), 4), "az_a");
-
-	list.insert(items[2]);
-	ASSERT_EQ(ToString(list, list.begin(), 5), "abz_a");
-
-	list.insert(items[3]);
-	ASSERT_EQ(ToString(list, list.begin(), 6), "abqz_a");
-
-	list.insert(items[4]);
-	ASSERT_EQ(ToString(list, list.begin(), 7), "abbqz_a");
-
-	list.insert(items[5]);
-	ASSERT_EQ(ToString(list, list.begin(), 8), "abbcqz_a");
-
-	list.insert(items[6]);
-	ASSERT_EQ(ToString(list, list.begin(), 9), "abbcqtz_a");
-
-	list.insert(items[7]);
-	ASSERT_EQ(ToString(list, list.begin(), 10), "abbcmqtz_a");
-
-	list.insert(items[8]);
-	ASSERT_EQ(ToString(list, list.begin(), 11), "abbcmqtyz_a");
-}