Skip to content

Commit cba90bc

Browse files
authored
make fold.expresion.cpp work with negative values
1 parent ff6ee89 commit cba90bc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: exercises/2/fold.expresion.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
#include <iostream>
1212
template<typename ... T>
1313
auto average(T ... t) {
14-
return (t + ... ) / sizeof...(t);
14+
return static_cast<double>((t + ... )) / sizeof...(t);
1515
}
1616
int main() {
1717
std::cout << average(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) << std::endl;
18-
}
18+
}

0 commit comments

Comments
 (0)