Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplification of the field access macros #356

Closed
llaniewski opened this issue Jun 3, 2021 · 1 comment
Closed

Simplification of the field access macros #356

llaniewski opened this issue Jun 3, 2021 · 1 comment
Assignees
Labels
enhancement New features/updates

Comments

@llaniewski
Copy link
Member

llaniewski commented Jun 3, 2021

The field access macros (both develop and unstable) can be greatly simplified using the design below:

template <int x = 0, int y = 0> void fun() {
    printf("static x:%d static y:%d\n", x, y);
}

template <int y = 0> void fun(int x) {
    printf("dynamic x:%d static y:%d\n", x, y);
}

void fun(int x, int y) {
    printf("dynamic x:%d dynamic y:%d\n", x, y);
}

#define fun_static(...) fun<__VA_ARGS__>()
#define fun_dynamic(...) fun(__VA_ARGS__)

Notes

I investigated compiler level discovery of static/dynamic value, and no solutions (even C++2a) were viable. The current user-level choice between f1(0,0) and f1_dyn(dx,dy), will be kept.

@llaniewski llaniewski added the enhancement New features/updates label Jun 3, 2021
@llaniewski llaniewski self-assigned this Jun 3, 2021
@llaniewski
Copy link
Member Author

Mostly done by #440

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New features/updates
Projects
None yet
Development

No branches or pull requests

1 participant