Pārlūkot izejas kodu

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

Andreas Kling 6 gadi atpakaļ
vecāks
revīzija
e38f40a83c
1 mainītis faili ar 9 papildinājumiem un 0 dzēšanām
  1. 9 0
      Kernel/InlineLinkedList.h

+ 9 - 0
Kernel/InlineLinkedList.h

@@ -58,6 +58,15 @@ public:
     void remove(T*);
     void remove(T*);
     void append(InlineLinkedList<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:
 private:
     T* m_head { nullptr };
     T* m_head { nullptr };
     T* m_tail { nullptr };
     T* m_tail { nullptr };