Why doesn\'t C allow a function with variable length argument list such as:
void f(...)
{
// do something...
}
Playing around with it, made this nice implementation that I think some people might want to consider.
template
void print(T first, ...)
{
va_list vl;
va_start(vl, first);
T temp = first;
do
{
cout << temp << endl;
}
while (temp = va_arg(vl, T));
va_end(vl);
}
It ensures you have one variable minimum, but allows you to put them all in a loop in a clean way.