On Wednesday, 2 March 2016 at 19:42:02 UTC, Ozan wrote:
I despair of "auto var1 = var2"for arrays. Isn't it a open door for errors. Example
        int[] a;
        foreach(i; 0..10) a ~= i;
        auto b = a; // correct dlang coding: auto b = a.dup;

It'd do exactly the same thing if you wrote

int[] b = a;

so the auto changes nothing there. Generally, the slice assignment is a good thing because it gives you easy efficiency and doesn't hide the costs of a duplicate.

Reply via email to