I want to ask through this simple example: how could I take the last value from a variadic pack and print(1, 2, 3.14)
to call print(3,14)
?
void print()
{
cout<<"--empty--";
}
void print(x)
{
std::cout<<"Last Value from variadic pac--" << x;
}
template <typename T, typename... Types>
void print(T var1, Types... var2)
{
int x = // last value from variadic pac : 3.14
print(x) // 3.14
}
int main()
{
print(1, 2, 3.14);
return 0;
}
Aucun commentaire:
Enregistrer un commentaire