I've been looking for the answer but i'm not sure, do variable argument functions get created or resolved at compile time or dynamically? For example , is it ok to take user's input at run-time and then call the function according to how many inputs were entered? Thanks
void func(int num_args, ...)
{
....
}
The number and types of function arguments are resolved at compile time, the values are resolved at compile-time or run-time depending on whether their value is
constexpr
-like or not.Think about how you would call a function with an arbitrary number of variables collected at runtime. There is no C++ syntax for such a construct.
What you should do instead is use something like
std::vector
. An example with some dummy functions: