Hi. How to rewrite this code on D? #include <string> #include <iostream>
template <typename T>
T foo(const T &val)
{
return val;
}
template <typename T, typename ...U>
T foo(const T &val, const U &...u)
{
return val + foo(u...);
}
int main()
{
std::cout << foo(std::string("some "), std::string("test"))
<< std::endl; // prints some test
std::cout << foo(2, 2, 1) << std::endl; // prints 5
}
