diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2022-12-09 20:05:00 +0330 |
---|---|---|
committer | Ali Mohammad Pur <Ali.mpfard@gmail.com> | 2022-12-11 20:44:54 +0330 |
commit | 7a17fd6d71d7fb5d4963147af96e0258cad32393 (patch) | |
tree | 84930a98cd9bb9dfa90685d155ac5ad807651dc8 /AK | |
parent | c547b55a005abe09c6802f96f79cfe9fec60f747 (diff) | |
download | serenity-7a17fd6d71d7fb5d4963147af96e0258cad32393.zip |
AK: Add a DeprecatedString::byte_at() getter
`operator[]` returns a char, this is used in Jakt.
Diffstat (limited to 'AK')
-rw-r--r-- | AK/DeprecatedString.h | 6 |
1 files changed, 6 insertions, 0 deletions
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<u8>((*m_impl)[i]); + } + using ConstIterator = SimpleIterator<const DeprecatedString, char const>; [[nodiscard]] constexpr ConstIterator begin() const { return ConstIterator::begin(*this); } |