diff --git a/AK/SinglyLinkedListWithCount.h b/AK/SinglyLinkedListWithCount.h index a84762bae4..1ef8c1273e 100644 --- a/AK/SinglyLinkedListWithCount.h +++ b/AK/SinglyLinkedListWithCount.h @@ -80,16 +80,11 @@ public: return List::take_first(); } - void append(const T& value) + template + void append(U&& value) { m_count++; - return SinglyLinkedList::append(value); - } - - void append(T&& value) - { - m_count++; - return List::append(move(value)); + return List::append(forward(value)); } bool contains_slow(const T& value) const @@ -135,28 +130,18 @@ public: return List::remove(iterator); } - void insert_before(Iterator iterator, const T& value) + template + void insert_before(Iterator iterator, U&& value) { m_count++; - List::insert_before(iterator, value); + List::insert_before(iterator, forward(value)); } - void insert_before(Iterator iterator, T&& value) + template + void insert_after(Iterator iterator, U&& value) { m_count++; - List::insert_before(iterator, move(value)); - } - - void insert_after(Iterator iterator, const T& value) - { - m_count++; - List::insert_after(iterator, value); - } - - void insert_after(Iterator iterator, T&& value) - { - m_count++; - List::insert_after(iterator, move(value)); + List::insert_after(iterator, forward(value)); } private: