mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
AK: Annotate DoublyLinkedList functions with [[nodiscard]]
This commit is contained in:
parent
5165661799
commit
eaa9ec9b5d
Notes:
sideshowbarker
2024-07-18 20:32:25 +09:00
Author: https://github.com/bgianfo Commit: https://github.com/SerenityOS/serenity/commit/eaa9ec9b5d5 Pull-request: https://github.com/SerenityOS/serenity/pull/6234
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…
Reference in a new issue