attribute length missing in std.array: Appender

bearophile via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Nov 28 16:32:39 PST 2014


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


More information about the Digitalmars-d-learn mailing list