I've got the class member:
LineND::LineND(double a ...)
{
coefficients.push_back(a);
va_list arguments;
va_start(arguments, a);
double argValue;
do
{
argValue = va_arg(arguments, double);
coefficients.push_back(argValue);
}while(argValue != NULL); // THIS IS A PROBLEM POINT!
va_end(arguments);
}
I don't know how many arguments will be used. I need to take each argument and put it into the vector called coefficients
. How should I do that? I understand, that the statement while(argValue != NULL)
is not correct in this case. I can't use for example this signature:
LineND::LineND(int numArgs, double a ...)
to change the condition like this:
while(argValue != numArgs);
The point is I can't change the signature of the method. Need to resolve this problem another way.