mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 22:37:35 +00:00
AK: Annotate DoublyLinkedList functions with [[nodiscard]]
This commit is contained in:
parent
5165661799
commit
eaa9ec9b5d
1 changed files with 7 additions and 7 deletions
|
@ -44,7 +44,7 @@ public:
|
||||||
}
|
}
|
||||||
ElementType& operator*() { return m_node->value; }
|
ElementType& operator*() { return m_node->value; }
|
||||||
ElementType* operator->() { return &m_node->value; }
|
ElementType* operator->() { return &m_node->value; }
|
||||||
bool is_end() const { return !m_node; }
|
[[nodiscard]] bool is_end() const { return !m_node; }
|
||||||
static DoublyLinkedListIterator universal_end() { return DoublyLinkedListIterator(nullptr); }
|
static DoublyLinkedListIterator universal_end() { return DoublyLinkedListIterator(nullptr); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -76,7 +76,7 @@ public:
|
||||||
DoublyLinkedList() = default;
|
DoublyLinkedList() = default;
|
||||||
~DoublyLinkedList() { clear(); }
|
~DoublyLinkedList() { clear(); }
|
||||||
|
|
||||||
bool is_empty() const { return !m_head; }
|
[[nodiscard]] bool is_empty() const { return !m_head; }
|
||||||
|
|
||||||
void clear()
|
void clear()
|
||||||
{
|
{
|
||||||
|
@ -89,22 +89,22 @@ public:
|
||||||
m_tail = nullptr;
|
m_tail = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
T& first()
|
[[nodiscard]] T& first()
|
||||||
{
|
{
|
||||||
VERIFY(m_head);
|
VERIFY(m_head);
|
||||||
return m_head->value;
|
return m_head->value;
|
||||||
}
|
}
|
||||||
const T& first() const
|
[[nodiscard]] const T& first() const
|
||||||
{
|
{
|
||||||
VERIFY(m_head);
|
VERIFY(m_head);
|
||||||
return m_head->value;
|
return m_head->value;
|
||||||
}
|
}
|
||||||
T& last()
|
[[nodiscard]] T& last()
|
||||||
{
|
{
|
||||||
VERIFY(m_head);
|
VERIFY(m_head);
|
||||||
return m_tail->value;
|
return m_tail->value;
|
||||||
}
|
}
|
||||||
const T& last() const
|
[[nodiscard]] const T& last() const
|
||||||
{
|
{
|
||||||
VERIFY(m_head);
|
VERIFY(m_head);
|
||||||
return m_tail->value;
|
return m_tail->value;
|
||||||
|
@ -147,7 +147,7 @@ public:
|
||||||
m_head = node;
|
m_head = node;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool contains_slow(const T& value) const
|
[[nodiscard]] bool contains_slow(const T& value) const
|
||||||
{
|
{
|
||||||
return find(value) != end();
|
return find(value) != end();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue