mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 13:47:35 +00:00
AK: Add Span::reverse()
It works like Vector::reverse().
This commit is contained in:
parent
e9dda2a5f8
commit
bda162fc0d
1 changed files with 6 additions and 0 deletions
|
@ -276,6 +276,12 @@ public:
|
|||
return at(index);
|
||||
}
|
||||
|
||||
void reverse()
|
||||
{
|
||||
for (size_t i = 0; i < size() / 2; ++i)
|
||||
AK::swap(at(i), at(size() - i - 1));
|
||||
}
|
||||
|
||||
[[nodiscard]] ALWAYS_INLINE constexpr T& operator[](size_t index)
|
||||
{
|
||||
return at(index);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue