On Sat, 24 Jan 2015 20:49:01 +0000, Dominikus Dittes Scherkl 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;
> 
> -->  Error: function foo(ubyte c) is not callable using argument types
> (int)
> 
> and this is because of the f*** end-type cannot be ubyte because in
> phobos everywhere end is excluded, so I have to define it too large by
> one.
> 
> Has anyone any idea how to work around this?
> I would have no problem using an explicit cast, but where should I apply
> it?

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

Attachment: signature.asc
Description: PGP signature

Reply via email to