1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:57:46 +00:00

DoublyLinkedList: Implement find in terms of AK::find

Problem:
- The implementation of `find` is coupled to the implementation of
  `DoublyLinkedList`.
- `append` and `prepend` are implemented multiple times so that
  r-value references can be moved from into the new node. This is
  probably not called very often because a pr-value or x-value needs
  to be used here.

Solution:
- Decouple the implementation of `find` from the class by using a
  generic `find` algorithm.
- Make `append` and `prepend` be function templates so that they can
  have binding references which can be forwarded.
This commit is contained in:
Lenny Maiorani 2020-12-24 11:23:12 -07:00 committed by Andreas Kling
parent f99d1d3bd7
commit 853cb8af5c
4 changed files with 114 additions and 84 deletions

View file

@ -75,7 +75,7 @@ public:
{
ScopedSpinLock lock(m_requests_lock);
was_empty = m_requests.is_empty();
m_requests.append(request);
m_requests.append(RefPtr<AsyncDeviceRequest>(request));
}
if (was_empty)
request->do_start({});