Expressions for default arguments

This topic is 2320 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

I see that default arguments only support constants (nothing else is even parsed). Is it possible to add support for actual expressions (evaluated in the same scope as the function)? Then things like this are possible:
 class T { int A; void f(int a=5*A) { } } 

Currently i can't even put some of my macros as default arguments because they evaluate to things like (15), which is a proper expression but the parser dislikes the parentheses very much.

Share on other sites
I'll look into it. It shouldn't be too difficult. Thanks for the suggestion.