1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 22:47:44 +00:00

AK+Userland: Rename Array::front/back to first/last

This is the name that is used for every other collection type so let's
be consistent.
This commit is contained in:
Sam Atkins 2022-04-06 12:05:26 +01:00 committed by Andreas Kling
parent 359365a06a
commit c0ca6e470f
4 changed files with 7 additions and 7 deletions

View file

@ -34,11 +34,11 @@ struct Array {
return __data[index];
}
[[nodiscard]] constexpr T const& front() const { return at(0); }
[[nodiscard]] constexpr T& front() { return at(0); }
[[nodiscard]] constexpr T const& first() const { return at(0); }
[[nodiscard]] constexpr T& first() { return at(0); }
[[nodiscard]] constexpr T const& back() const requires(Size > 0) { return at(Size - 1); }
[[nodiscard]] constexpr T& back() requires(Size > 0) { return at(Size - 1); }
[[nodiscard]] constexpr T const& last() const requires(Size > 0) { return at(Size - 1); }
[[nodiscard]] constexpr T& last() requires(Size > 0) { return at(Size - 1); }
[[nodiscard]] constexpr bool is_empty() const { return size() == 0; }