Ali Çehreli:

void expandWith(A, R)(ref A arr, R range)
{
    foreach (e; range) {
        arr ~= e;
    }
}

I'd like a function like that in Phobos (with a little improvement: when the length of the given range is available inside expandWith, it should first extend the capacity to increase performance a little). But I'd call it "extend" as in Python.

Bye,
bearophile

Reply via email to