summaryrefslogtreecommitdiff
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
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.
-rw-r--r--AK/Array.h8
-rw-r--r--Userland/Applets/Audio/main.cpp2
-rw-r--r--Userland/Libraries/LibAudio/MP3Tables.h2
-rw-r--r--Userland/Libraries/LibGL/Tex/Texture2D.h2
4 files changed, 7 insertions, 7 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; }
diff --git a/Userland/Applets/Audio/main.cpp b/Userland/Applets/Audio/main.cpp
index ec3f6f77c2..74d539a957 100644
--- a/Userland/Applets/Audio/main.cpp
+++ b/Userland/Applets/Audio/main.cpp
@@ -199,7 +199,7 @@ private:
Gfx::Bitmap& choose_bitmap_from_volume()
{
if (m_audio_muted)
- return *m_volume_level_bitmaps.back().bitmap;
+ return *m_volume_level_bitmaps.last().bitmap;
for (auto& pair : m_volume_level_bitmaps) {
if (m_audio_volume >= pair.volume_threshold)
diff --git a/Userland/Libraries/LibAudio/MP3Tables.h b/Userland/Libraries/LibAudio/MP3Tables.h
index 4939d32876..0e773f95f5 100644
--- a/Userland/Libraries/LibAudio/MP3Tables.h
+++ b/Userland/Libraries/LibAudio/MP3Tables.h
@@ -115,7 +115,7 @@ constexpr auto MakeMixedScaleFactorBandArray()
Array<ScaleFactorBand, N> result {};
constexpr auto long_bands = MakeLongScaleFactorBandArray<sizes_long>();
- constexpr auto short_bands = MakeShortScaleFactorBandArray<sizes_short, long_bands.back().end + 1>();
+ constexpr auto short_bands = MakeShortScaleFactorBandArray<sizes_short, long_bands.last().end + 1>();
for (size_t i = 0; i < long_bands.size(); i++) {
result[i] = long_bands[i];
diff --git a/Userland/Libraries/LibGL/Tex/Texture2D.h b/Userland/Libraries/LibGL/Tex/Texture2D.h
index dc01cb0084..e471e18d16 100644
--- a/Userland/Libraries/LibGL/Tex/Texture2D.h
+++ b/Userland/Libraries/LibGL/Tex/Texture2D.h
@@ -34,7 +34,7 @@ public:
MipMap const& mipmap(unsigned lod) const
{
if (lod >= m_mipmaps.size())
- return m_mipmaps.back();
+ return m_mipmaps.last();
return m_mipmaps.at(lod);
}