summaryrefslogtreecommitdiff
path: root/AK
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2022-04-06 12:05:26 +0100
committerAndreas Kling <kling@serenityos.org>2022-04-06 14:31:52 +0200
commitc0ca6e470f27dfd7429b79f1015462a834c19408 (patch)
treeeafeed72bff085f8f00f48205bde594c65e74214 /AK
parent359365a06ae6fe9948ca2bb089688ae203690007 (diff)
downloadserenity-c0ca6e470f27dfd7429b79f1015462a834c19408.zip
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.
Diffstat (limited to 'AK')
-rw-r--r--AK/Array.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/AK/Array.h b/AK/Array.h
index d87cb1b9df..d4aa6791b8 100644
--- a/AK/Array.h
+++ b/AK/Array.h
@@ -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; }