Hi!
I am trying to figure out what's the best way to accomplish something like this:
1 2 3
|
void function(t1 a=0,t2 b=0){/*...*/};
t2 value;
function(value);
|
That would throw a compile error, since the first argument that is being passed to the function (
value) is considered the first argument in the declaration (
a), which is of type t1. So, is there a way to force my function to consider
value as the second argument instead of the first one?
I am aware that this could be done using overloading, but the larger the amount of arguments, the larger amount of possibilities, so it might end up with a huge list of overloads.
The best case scenario would be being able to set things like:
1 2
|
void function(t1 a=16,t1 b=0,t2 c=1){/*body*/};
function(b=3,a=0);
|
but I'm not aware of such feature in C++.
Would it be possible to design some sort of macro system to take care of this?
Thanks.