Weird const behavior

Adam D. Ruppe destructionator at gmail.com
Thu Dec 20 02:05:53 UTC 2018


On Thursday, 20 December 2018 at 01:37:59 UTC, Simón Oroño wrote:
> The only difference (code-wise) is the `const` keyword. I've 
> tried with both `ldc` and `dmd` with same result. Why is the 
> output different when the variable is `const`?

A const range cannot be iterated by a generic template (without 
additional work, at least), so writeln just sees it as a blob 
instead of something it can loop over.


More information about the Digitalmars-d-learn mailing list