mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 09:49:15 +03:00
TestArray: constexpr_sum using span
Problem: - `constexpr_sum` is implemented using `Array` which means the function needs to be a function template so that the size can be deduced. Solution: - Change the `Array` function argument to a `Span` since `Span` now is `constexpr`.
This commit is contained in:
parent
18a40587ea
commit
91ea6057d6
Notes:
sideshowbarker
2024-07-19 01:49:27 +09:00
Author: https://github.com/ldm5180 Commit: https://github.com/SerenityOS/serenity/commit/91ea6057d63 Pull-request: https://github.com/SerenityOS/serenity/pull/3812
@ -28,12 +28,10 @@
|
||||
|
||||
#include <AK/Array.h>
|
||||
|
||||
// FIXME: Use Span<const int> as soon as Span has all the constexpr stuff too.
|
||||
template<size_t Size>
|
||||
static constexpr int constexpr_sum(const Array<int, Size>& array)
|
||||
static constexpr int constexpr_sum(const Span<const int> span)
|
||||
{
|
||||
int sum = 0;
|
||||
for (auto value : array)
|
||||
for (auto value : span)
|
||||
sum += value;
|
||||
|
||||
return sum;
|
||||
|
Loading…
Reference in New Issue
Block a user