mirror of
https://github.com/SerenityOS/serenity
synced 2024-07-21 18:15:58 +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
|
@ -746,6 +746,12 @@ public:
|
|||
return {};
|
||||
}
|
||||
|
||||
void reverse()
|
||||
{
|
||||
for (size_t i = 0; i < size() / 2; ++i)
|
||||
AK::swap(at(i), at(size() - i - 1));
|
||||
}
|
||||
|
||||
private:
|
||||
void reset_capacity()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue