I have a function A(...) and B(...). Now I have to call B inside A, any methods to pass that ... from A into B? Pseudocode:
void A(...)
{
// Some operators
B(...); // Instead of ... I need to pass A's args
}
p.s. I know this could be done using macros but what about functions.
You can’t forward va_args. You can only forward va_list.
(This is also why functions like
vprintfexists.)If you are using C++11, you could do this with variadic templates with perfect forwarding: