mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
AK: Add at() indexing methods to FixedArray
This commit is contained in:
parent
09df8f812a
commit
75eb5e7984
Notes:
sideshowbarker
2024-07-17 18:11:52 +09:00
Author: https://github.com/kleinesfilmroellchen Commit: https://github.com/SerenityOS/serenity/commit/75eb5e7984 Pull-request: https://github.com/SerenityOS/serenity/pull/12733
1 changed files with 12 additions and 2 deletions
|
@ -128,18 +128,28 @@ public:
|
|||
T* data() { return m_elements; }
|
||||
T const* data() const { return m_elements; }
|
||||
|
||||
T& operator[](size_t index)
|
||||
T& at(size_t index)
|
||||
{
|
||||
VERIFY(index < m_size);
|
||||
return m_elements[index];
|
||||
}
|
||||
|
||||
T const& operator[](size_t index) const
|
||||
T const& at(size_t index) const
|
||||
{
|
||||
VERIFY(index < m_size);
|
||||
return m_elements[index];
|
||||
}
|
||||
|
||||
T& operator[](size_t index)
|
||||
{
|
||||
return at(index);
|
||||
}
|
||||
|
||||
T const& operator[](size_t index) const
|
||||
{
|
||||
return at(index);
|
||||
}
|
||||
|
||||
bool contains_slow(T const& value) const
|
||||
{
|
||||
for (size_t i = 0; i < m_size; ++i) {
|
||||
|
|
Loading…
Reference in a new issue