diff options
author | asynts <asynts@gmail.com> | 2020-08-14 12:16:17 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-08-15 21:21:18 +0200 |
commit | 36080c596430983a13f5e01408e34a9b52b78a0a (patch) | |
tree | e342be79f5d25956dc1517f36cbf990c9145a236 /AK | |
parent | 78849bbb48120651103fef0882ace6dc38c5c9c8 (diff) | |
download | serenity-36080c596430983a13f5e01408e34a9b52b78a0a.zip |
AK: Add fill() method to Span.
Diffstat (limited to 'AK')
-rw-r--r-- | AK/Span.h | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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); |