diff --git a/libluna/include/luna/LinkedList.h b/libluna/include/luna/LinkedList.h index a9e65276..52d66dc8 100644 --- a/libluna/include/luna/LinkedList.h +++ b/libluna/include/luna/LinkedList.h @@ -8,7 +8,7 @@ template class LinkedListNode { using SelfType = LinkedListNode; - private: + protected: SelfType* m_next_node; SelfType* m_last_node; @@ -284,3 +284,29 @@ template class LinkedList usize m_count = 0; }; + +struct Tag : public LinkedListNode +{ + public: + Tag(void* ptr) : m_ptr(ptr) + { + } + + ~Tag() + { + detach_from_list(); + } + + void* ptr() + { + return m_ptr; + } + + template T& as() + { + return *static_cast(m_ptr); + } + + private: + void* m_ptr; +};