Is there a compact way of skipping an out-parameter from a function call by passing some dummy?
In the example below I would like to write something like calc_multiples(myNum, NULL, myNumTimes3)
, because I do not need the second parameter and hence do not want to define a variable for that.
In python one would use _
for that..
#include <iostream>
/**
* Calculates multiples of number
*
* @param[in] t1 number to multiply
* @param[out] t2 multiplied by 2
* @param[out] t2 multiplied by 3
*/
void calc_multiples(const int t1, int &t2, int &t3)
{
t2 = 2*t1;
t3 = 3*t1;
return;
}
int main()
{
int myNum = 7;
int myNumTimes2; // I want to avoid this line
int myNumTimes3;
calc_multiples(myNum, myNumTimes2, myNumTimes3);
std::cout << "my number times 3: " << myNumTimes3;
return 0;
}