Ver código fonte

Add an InlineLinkedList::containsSlow(T*) helper.

Andreas Kling 6 anos atrás
pai
commit
e38f40a83c
1 arquivos alterados com 9 adições e 0 exclusões
  1. 9 0
      Kernel/InlineLinkedList.h

+ 9 - 0
Kernel/InlineLinkedList.h

@@ -58,6 +58,15 @@ public:
     void remove(T*);
     void append(InlineLinkedList<T>&);
 
+    bool containsSlow(T* value) const
+    {
+        for (T* node = m_head; node; node = node->next()) {
+            if (node == value)
+                return true;
+        }
+        return false;
+    }
+
 private:
     T* m_head { nullptr };
     T* m_tail { nullptr };