mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +00:00
Kernel: Use a FixedArray for a process's extra GIDs
There's not really enough of these to justify using a HashTable.
This commit is contained in:
@@ -54,7 +54,13 @@ public:
|
||||
new (&m_elements[i]) T(other[i]);
|
||||
}
|
||||
|
||||
FixedArray& operator=(const FixedArray&) = delete;
|
||||
FixedArray& operator=(const FixedArray& other)
|
||||
{
|
||||
FixedArray array(other);
|
||||
swap(array);
|
||||
return *this;
|
||||
}
|
||||
|
||||
FixedArray(FixedArray&&) = delete;
|
||||
FixedArray& operator=(FixedArray&&) = delete;
|
||||
|
||||
@@ -109,6 +115,21 @@ public:
|
||||
m_size = new_size;
|
||||
}
|
||||
|
||||
bool contains(const T& value) const
|
||||
{
|
||||
for (size_t i = 0; i < m_size; ++i) {
|
||||
if (m_elements[i] == value)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void swap(FixedArray& other)
|
||||
{
|
||||
::swap(m_elements, other.m_elements);
|
||||
::swap(m_size, other.m_size);
|
||||
}
|
||||
|
||||
using Iterator = VectorIterator<FixedArray, T>;
|
||||
Iterator begin() { return Iterator(*this, 0); }
|
||||
Iterator end() { return Iterator(*this, size()); }
|
||||
|
||||
Reference in New Issue
Block a user