using the full range of ubyte with iota

H. S. Teoh via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jan 24 13:02:45 PST 2015


On Sat, Jan 24, 2015 at 08:49:01PM +0000, Dominikus Dittes Scherkl via Digitalmars-d-learn wrote:
> Maybe I'm just too stupid, but I cannot manage to call a simple function
> with all 256 possible values of ubyte with iote:
> 
> int foo(ubyte c);
> 
> auto myRange = iota(0,256).map!foo;
[...]

Try:

	auto myRange = iota(0, 256).map!(a => foo(cast(ubyte)a));


T

-- 
Shin: (n.) A device for finding furniture in the dark.


More information about the Digitalmars-d-learn mailing list