Код: Выделить всё
#include
template
auto average(const T0& first)
{
static const std::size_t value = 1;
return first;
}
template
auto average(const T0& first, const Ts&... pack)
{
value++;
return (first + average(pack... ) / (value + 1));
}
int main()
{
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79851615/c-template-parameter-packs-for-math-functions[/url]
Мобильная версия