i know it's not strictly wx q, but i was wondering if someone could help me.
The problem is as follows:
I don't know how many arguments will be in a function. I am aware of putting the overall number of arguments in the argument list, or putting the terminator argument, but....
Is there a way to just don't know the overall number of arguments of a fn and still manage the code efficiently?
E.g.
Code: Select all
void fn(int id, ...)
{
va_list argptr;
int selection;
va_start(argptr,id);
while( selection != -1 )
{
selection = va_arg( argptr, int);
some_vector.push_back(selection);
}
va_end(argptr);
}
Thanx,
fantaz