mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-13 04:52:23 +00:00
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: 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;
|
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 const* data() const { return __data; }
|
||||||
[[nodiscard]] constexpr T* data() { return __data; }
|
[[nodiscard]] constexpr T* data() { return __data; }
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue