On 15.12.14 01:00, "Nordlöw" wrote: > Isn't this algorithm already encoded somewhere in Phobos?
void append(T, Args...)(ref T[] arr, auto ref Args args){
{
static if (args.length == 1)
arr ~= args[0]; // inlined
else{
arr.length += args.length;
foreach(i, e; args)
arr[$ - args.length + i] = e;
}
}
I've just tested, this looks usable.
Equal for 1 item, considerably (~40%) faster for 2, and much (100+%) faster for
more.
Also more convenient.
Maybe samthing like that should go to Fobos.
