AK: Add fill() method to Span.

This commit is contained in:
asynts 2020-08-14 12:16:17 +02:00 committed by Andreas Kling
parent 78849bbb48
commit 36080c5964

View file

@ -176,6 +176,13 @@ public:
__builtin_memmove(other.data(), data(), sizeof(T) * min(size(), other.size()));
}
ALWAYS_INLINE void fill(const T& value)
{
for (size_t idx = 0; idx < size(); ++idx) {
data()[idx] = value;
}
}
ALWAYS_INLINE const T& at(size_t index) const
{
ASSERT(index < this->m_size);