mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:57:35 +00:00
AK: Add a simple Queue<T> class.
The underlying data structure is a singly-linked list of Vector<T>. We never shift any of the vector contents around, but we batch the memory allocations into 1000-element segments.
This commit is contained in:
parent
9443957c14
commit
c699d9d79d
4 changed files with 87 additions and 4 deletions
|
@ -9,7 +9,7 @@ class SinglyLinkedList {
|
|||
private:
|
||||
struct Node {
|
||||
explicit Node(T&& v)
|
||||
: value(v)
|
||||
: value(move(v))
|
||||
{
|
||||
}
|
||||
T value;
|
||||
|
@ -66,7 +66,7 @@ public:
|
|||
{
|
||||
ASSERT(m_head);
|
||||
auto* prev_head = m_head;
|
||||
T value = first();
|
||||
T value = move(first());
|
||||
if (m_tail == m_head)
|
||||
m_tail = nullptr;
|
||||
m_head = m_head->next;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue