mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:37:46 +00:00
AK: Add Vector::take(index)
This removes an item from the vector and returns it.
This commit is contained in:
parent
d6f9349f15
commit
870be9d71e
1 changed files with 7 additions and 0 deletions
|
@ -263,6 +263,13 @@ public:
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
T take(int index)
|
||||||
|
{
|
||||||
|
T value = move(at(index));
|
||||||
|
remove(index);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
void remove(int index)
|
void remove(int index)
|
||||||
{
|
{
|
||||||
ASSERT(index < m_size);
|
ASSERT(index < m_size);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue