mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:57:44 +00: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
1 changed files with 2 additions and 4 deletions
|
@ -28,12 +28,10 @@
|
||||||
|
|
||||||
#include <AK/Array.h>
|
#include <AK/Array.h>
|
||||||
|
|
||||||
// FIXME: Use Span<const int> as soon as Span has all the constexpr stuff too.
|
static constexpr int constexpr_sum(const Span<const int> span)
|
||||||
template<size_t Size>
|
|
||||||
static constexpr int constexpr_sum(const Array<int, Size>& array)
|
|
||||||
{
|
{
|
||||||
int sum = 0;
|
int sum = 0;
|
||||||
for (auto value : array)
|
for (auto value : span)
|
||||||
sum += value;
|
sum += value;
|
||||||
|
|
||||||
return sum;
|
return sum;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue