I'm writing a constexpr product function with variadic arguments. I have only been able to get "Version 1" working below. When attempting to compile "Version 2", I get the error Declaration type contains unexpanded parameter pack 'data_type'. Can anyone explain why this is the case?
/** Version 1. */
template <typename data_type, typename ...data_types>
constexpr data_type Product1(data_type _first, data_types ..._rest) // This code compiles :)
{
return _first*(_rest * ...);
}
/** Version 2. */
template <typename ...data_type>
constexpr data_type Product2(data_type ..._rest) // This code does not compile :(
{
return (_rest * ...);
}