Reputation: 5188
I vaguely remember that it was possible to write something like:
void f(int a, int b=0, bool c=!val);
if some extra stuff was written at the beginning of the arguments list. The example in GCC gives error of val
non declared in scope.
Unfortunately, I cannot find any reference on the Internet, so I ask here.
Upvotes: 0
Views: 63
Reputation: 4103
How about overloading f()? It won't be a problem whether val is const or not.
void f(int a, int b, bool c);
void f(int a, int b=0) {
f(a,b,!val);
}
Upvotes: 1