AK: Add Array::from_repeated_value()
This commit is contained in:
parent
afea177d41
commit
e2d4952f0f
Notes:
sideshowbarker
2024-07-16 23:55:09 +09:00
Author: https://github.com/timschumi Commit: https://github.com/SerenityOS/serenity/commit/e2d4952f0f Pull-request: https://github.com/SerenityOS/serenity/pull/22202 Reviewed-by: https://github.com/ADKaster ✅ Reviewed-by: https://github.com/LucasChollet
1 changed files with 7 additions and 0 deletions
|
@ -37,6 +37,13 @@ struct Array {
|
|||
return array;
|
||||
}
|
||||
|
||||
static constexpr Array from_repeated_value(T const& value)
|
||||
{
|
||||
Array array;
|
||||
array.fill(value);
|
||||
return array;
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr T const* data() const { return __data; }
|
||||
[[nodiscard]] constexpr T* data() { return __data; }
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue