Skip to content

n-ary transform function #121

@grisumbras

Description

@grisumbras

The way I see it, it should be something like system::invoke that invokes a callable with N (0+) arguments of which some can be results. In addition, for convenience it should invoke the callable similar to what std::invoke does.

Example

Foo
Processor::compose_abc(A const&, B const&, C const&);

system::result<Foo>
read_config(Processor& p, Config const& config)
{
    auto a = maybe_get_a(config);
    auto b = maybe_get_b(config);
    auto c = maybe_get_c(config);
    return system::invoke(&Processor::compose_abc, p, a, b, c);
}

One interesting question is whether result<void> arguments should be allowed. The semantics would be to ignore them when invoking the callable, but that would complicate implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions