mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
AK: Add an implementation of Array<T, Size>::fill(...)
This commit is contained in:
parent
21a959e29b
commit
df73a86875
Notes:
sideshowbarker
2024-07-18 22:03:36 +09:00
Author: https://github.com/bgianfo Commit: https://github.com/SerenityOS/serenity/commit/df73a868756 Pull-request: https://github.com/SerenityOS/serenity/pull/5448 Reviewed-by: https://github.com/awesomekling
1 changed files with 8 additions and 0 deletions
|
@ -78,6 +78,14 @@ struct Array {
|
|||
constexpr operator Span<const T>() const { return span(); }
|
||||
constexpr operator Span<T>() { return span(); }
|
||||
|
||||
constexpr size_t fill(const T& value)
|
||||
{
|
||||
for (size_t idx = 0; idx < Size; ++idx)
|
||||
__data[idx] = value;
|
||||
|
||||
return Size;
|
||||
}
|
||||
|
||||
T __data[Size];
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue