Defining a static array with values in a range

Jonathan M Davis via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jan 22 09:15:25 PST 2015


On Thursday, January 22, 2015 15:16:07 bearophile via Digitalmars-d-learn wrote:
> Jonathan M Davis:
>
> > but that's easy fixed with some +1's.
>
> But the +1 changes the char to an int.

True, though iota doesn't seem to like to operate on char anyway, so from
the little playing around with it I did to answer the OP, it looks like
you're forced to use casts for it anyway. And depending, you probably want
to cast to ubyte and then convert that to char when you convert the range to
an array to avoid the conversion to dchar anyway. So, all around, trying to
use iota with char is a bit awkward.

- Jonathan M Davis



More information about the Digitalmars-d-learn mailing list