AK/Vector: Add Vector::reverse() method

This reverses the contents of the vector in-place.
This commit is contained in:
Mustafa Quraish 2021-09-16 00:54:50 -04:00 committed by Brian Gianforcaro
parent a339b73fc2
commit 27f28998b1

View file

@ -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()
{