mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 05:17:35 +00:00
AK/Vector: Add Vector::reverse()
method
This reverses the contents of the vector in-place.
This commit is contained in:
parent
a339b73fc2
commit
27f28998b1
1 changed files with 6 additions and 0 deletions
|
@ -746,6 +746,12 @@ public:
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reverse()
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < size() / 2; ++i)
|
||||||
|
AK::swap(at(i), at(size() - i - 1));
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void reset_capacity()
|
void reset_capacity()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue