From 7a17fd6d71d7fb5d4963147af96e0258cad32393 Mon Sep 17 00:00:00 2001 From: Ali Mohammad Pur Date: Fri, 9 Dec 2022 20:05:00 +0330 Subject: [PATCH] AK: Add a DeprecatedString::byte_at() getter `operator[]` returns a char, this is used in Jakt. --- AK/DeprecatedString.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/AK/DeprecatedString.h b/AK/DeprecatedString.h index 0b84762e5e..c7e4aad728 100644 --- a/AK/DeprecatedString.h +++ b/AK/DeprecatedString.h @@ -192,6 +192,12 @@ public: return (*m_impl)[i]; } + [[nodiscard]] ALWAYS_INLINE u8 byte_at(size_t i) const + { + VERIFY(!is_null()); + return bit_cast((*m_impl)[i]); + } + using ConstIterator = SimpleIterator; [[nodiscard]] constexpr ConstIterator begin() const { return ConstIterator::begin(*this); }