From c0ca6e470f27dfd7429b79f1015462a834c19408 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Wed, 6 Apr 2022 12:05:26 +0100 Subject: [PATCH] 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. --- AK/Array.h | 8 ++++---- Userland/Applets/Audio/main.cpp | 2 +- Userland/Libraries/LibAudio/MP3Tables.h | 2 +- Userland/Libraries/LibGL/Tex/Texture2D.h | 2 +- 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 result {}; constexpr auto long_bands = MakeLongScaleFactorBandArray(); - constexpr auto short_bands = MakeShortScaleFactorBandArray(); + constexpr auto short_bands = MakeShortScaleFactorBandArray(); 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); }