Skip to content

Commit

Permalink
AK: Add Array::from_repeated_value()
Browse files Browse the repository at this point in the history
  • Loading branch information
timschumi authored and ADKaster committed Dec 14, 2023
1 parent afea177 commit e2d4952
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions AK/Array.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; }

Expand Down

0 comments on commit e2d4952

Please sign in to comment.