Sign in to follow this  

Expressions for default arguments

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 this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this