impl for sum (maybe) but still need tests for it
This commit is contained in:
parent
4cd1bd8694
commit
f228430658
1 changed files with 7 additions and 0 deletions
7
sum.cpp
Normal file
7
sum.cpp
Normal file
|
@ -0,0 +1,7 @@
|
|||
#include <iostream>
|
||||
|
||||
template <typename T> auto sum(T final) { return final; }
|
||||
template <typename T, typename... Ts> auto sum(T first, Ts... rem) {
|
||||
return first + sum<Ts...>(rem...);
|
||||
}
|
||||
int main(void) { std::cout << sum<double, int, int, int>(1.5, 2, 3, 10); }
|
Loading…
Reference in a new issue