import std.typecons: Tuple, tuple;
import std.algorithm: reduce;

struct Foo { int x; }

auto foo(in Tuple!(Foo[]) arg, int) {
    return tuple(arg[0]);
}

void main() {
    int[] data;
    Foo[] empty;
    auto seed = tuple(empty);
    reduce!foo(seed, data);
}

I have found a solution:

import std.typecons: Tuple, tuple;
import std.algorithm: reduce;

auto foo(in Tuple!(const(int)[]) arg, int) {
    return tuple(arg[0]);
}

void main() {
    int[] empty;
    Tuple!(const(int)[]) seed;
    reduce!foo(seed, [1]);
}


Bye,
bearophile

Reply via email to