mirror of
https://github.com/thunderbrewhq/squall.git
synced 2026-02-04 00:49:08 +00:00
feat(list): add TSList::IsEmpty
This commit is contained in:
parent
d590e2e94f
commit
b52736a360
2 changed files with 26 additions and 0 deletions
|
|
@ -30,6 +30,7 @@ class TSList {
|
|||
T* DeleteNode(T* ptr);
|
||||
T* Head();
|
||||
void InitializeTerminator();
|
||||
bool IsEmpty();
|
||||
bool IsLinked(T* ptr);
|
||||
TSLink<T>* Link(const T* ptr);
|
||||
void LinkNode(T* ptr, uint32_t linktype, T* existingptr);
|
||||
|
|
@ -96,6 +97,11 @@ void TSList<T, TGetLink>::InitializeTerminator() {
|
|||
this->m_terminator.m_next = reinterpret_cast<T*>(~reinterpret_cast<uintptr_t>(&this->m_terminator));
|
||||
}
|
||||
|
||||
template <class T, class TGetLink>
|
||||
bool TSList<T, TGetLink>::IsEmpty() {
|
||||
return this->Head() == nullptr;
|
||||
}
|
||||
|
||||
template <class T, class TGetLink>
|
||||
bool TSList<T, TGetLink>::IsLinked(T* ptr) {
|
||||
return TGetLink::Link(ptr, this->m_linkoffset)->IsLinked();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue