Skip to content

Allow function pointer as parameter #36

@Telcrome

Description

@Telcrome

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);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions