1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:07:44 +00:00

AK: Add span() / bytes() methods to container types.

This commit is contained in:
asynts 2020-07-27 14:15:37 +02:00 committed by Andreas Kling
parent c42450786c
commit a922abd9d7
4 changed files with 24 additions and 5 deletions

View file

@ -137,6 +137,9 @@ public:
ALWAYS_INLINE bool is_empty() const { return length() == 0; }
ALWAYS_INLINE size_t length() const { return m_impl ? m_impl->length() : 0; }
ALWAYS_INLINE const char* characters() const { return m_impl ? m_impl->characters() : nullptr; }
ALWAYS_INLINE ReadonlyBytes bytes() const { return m_impl ? m_impl->bytes() : nullptr; }
ALWAYS_INLINE const char& operator[](size_t i) const
{
return (*m_impl)[i];