mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 19:45:12 +00:00
AK: Add fill() method to Span.
This commit is contained in:
parent
78849bbb48
commit
36080c5964
Notes:
sideshowbarker
2024-07-19 03:35:05 +09:00
Author: https://github.com/asynts Commit: https://github.com/SerenityOS/serenity/commit/36080c59643 Pull-request: https://github.com/SerenityOS/serenity/pull/3166 Reviewed-by: https://github.com/nico
1 changed files with 7 additions and 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);
|
||||
|
|
Loading…
Add table
Reference in a new issue