Avoid subtracting form .length

Manfred Nowak svv1999 at hotmail.com
Thu Nov 14 13:08:36 UTC 2024


On Saturday, 9 November 2024 at 04:02:46 UTC, Jonathan M Davis 
wrote:
[...]
>     b[0 .. a.length-1] = a[];
>
> You'll get a RangeError being thrown when you run the code.
[...]

Therefore a fix might be to not deminish the length:
     b[ 0 .. a.length]= a[];

-manfred



More information about the Digitalmars-d-learn mailing list