You are not logged in.

#1 2016-11-11 17:53:03

snack
Member
From: Italy
Registered: 2009-01-13
Posts: 861

Pass-through of variable arguments in C++

I have a function called functionB with a variable number of arguments; in its implementation I want to call functionA with the same arguments passed to functionB, but I don't know the syntax (or even if it's possible at all):

int functionA(string s, ...){
  <do some work here>
}

int functionB(string s, ...){
  return functionA(s, <what should I put here?>);
}

Thanks for the help.

Offline

#2 2016-11-11 17:55:07

snack
Member
From: Italy
Registered: 2009-01-13
Posts: 861

Re: Pass-through of variable arguments in C++

Nevermind, I found a solution:

http://stackoverflow.com/questions/2055 … nts-around

Thanks anyway!

Offline

#3 2016-11-13 22:22:39

lnxsurf
Member
Registered: 2014-05-28
Posts: 68

Re: Pass-through of variable arguments in C++

Maybe variadic templates could be a solution for you?

Offline

#4 2016-11-13 23:05:50

snack
Member
From: Italy
Registered: 2009-01-13
Posts: 861

Re: Pass-through of variable arguments in C++

Sadly we don't mandate a C++11 compiler, so vardiadic templates are not a feasible solution. But yes, they could have been.

Offline

Board footer

Powered by FluxBB