monarch_dodra:

uint[] foo3(const(uint[])[] X)
{
    assert(!X.empty);
    auto seed = X.front.dup;
    X.popFront();
    return reduce!((i, j) => i[] |= j[])
                  (seed, X);
}
//----

This gives the same "logical" result, but reuses the seed contents on every iteration.

Nice, thank you :-)

And with a miniscule de-optimization it becomes very good:
https://d.puremagic.com/issues/show_bug.cgi?id=10523

Bye,
bearophile

Reply via email to