libluna: Add LinkedList tags
All checks were successful
Build and test / build (push) Successful in 1m51s

This commit is contained in:
apio 2024-03-03 14:52:23 +01:00
parent 5975e58b4a
commit f05fea441c
Signed by: apio
GPG Key ID: B8A7D06E42258954

View File

@ -8,7 +8,7 @@ template <typename T> class LinkedListNode
{
using SelfType = LinkedListNode<T>;
private:
protected:
SelfType* m_next_node;
SelfType* m_last_node;
@ -284,3 +284,29 @@ template <typename T> class LinkedList
usize m_count = 0;
};
struct Tag : public LinkedListNode<Tag>
{
public:
Tag(void* ptr) : m_ptr(ptr)
{
}
~Tag()
{
detach_from_list();
}
void* ptr()
{
return m_ptr;
}
template <typename T> T& as()
{
return *static_cast<T*>(m_ptr);
}
private:
void* m_ptr;
};