mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 13:36:13 +03: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: 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
@ -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…
Reference in New Issue
Block a user