libluna: Add LinkedList tags
All checks were successful
Build and test / build (push) Successful in 1m51s
All checks were successful
Build and test / build (push) Successful in 1m51s
This commit is contained in:
parent
5975e58b4a
commit
f05fea441c
@ -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;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user