how to do iota(0,256) with ubytes ? (cf need for iotaInclusive)
Per Nordlöw via Digitalmars-d
digitalmars-d at puremagic.com
Mon Oct 12 01:38:38 PDT 2015
On Friday, 9 October 2015 at 07:20:43 UTC, John Colvin wrote:
> For anyone googling for a solution to this, here's a workaround:
>
> auto b = iota(0, 256).map!"cast(ubyte)a";
Without string lambdas:
auto b = iota(0, 256).map!(a => cast(ubyte)a);
I would suggest to turn this pattern into a new algorithm
typically called
iotaOf(T, B, E)(B begin, E end);
called as
iotaOf!ubyte(0,256)
and use `std.conv.to` instead.
More information about the Digitalmars-d
mailing list