diff --git a/AK/FixedArray.h b/AK/FixedArray.h index 7e86166746f..a63c57fcb5c 100644 --- a/AK/FixedArray.h +++ b/AK/FixedArray.h @@ -26,6 +26,7 @@ #pragma once +#include #include namespace AK { @@ -33,7 +34,7 @@ namespace AK { template class FixedArray { public: - FixedArray() {} + FixedArray() { } explicit FixedArray(size_t size) : m_size(size) { @@ -86,6 +87,9 @@ public: return m_elements; } + Bytes bytes() { return { data(), size() }; } + ReadonlyBytes bytes() const { return { data(), size() }; } + T& operator[](size_t index) { ASSERT(index < m_size); @@ -138,6 +142,9 @@ public: ConstIterator begin() const { return ConstIterator(*this, 0); } ConstIterator end() const { return ConstIterator(*this, size()); } + operator Bytes() { return bytes(); } + operator ReadonlyBytes() const { return bytes(); } + private: size_t m_size { 0 }; T* m_elements { nullptr };