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

Allow function pointer as parameter #36

Open
Telcrome opened this issue Feb 19, 2020 · 0 comments
Open

Allow function pointer as parameter #36

Telcrome opened this issue Feb 19, 2020 · 0 comments
Labels
enhancement New feature or request language

Comments

@Telcrome
Copy link

We face many code duplicates of the following form:

if (!lock)
    arbitrary_code();
test(lock);

There seems to be no elegant way to avoid writing the whole thing over and over again, we even have to negate the lock by hand.
My idea would be to enable function pointer as parameters, then we could implement it in the following form:

procedure wait_wrapper(function<bool> lock, function<Any> f) {
    if (!lock) {f}
    test(lock);
}
@vmatare vmatare added enhancement New feature or request language labels Dec 10, 2020
@vmatare vmatare changed the title [RFE] Allow function pointer as parameter Allow function pointer as parameter Dec 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request language
Projects
None yet
Development

No branches or pull requests

2 participants