using the full range of ubyte with iota

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jan 24 15:19:11 PST 2015


On Sat, 24 Jan 2015 22:57:57 +0000, Dominikus Dittes Scherkl wrote:

> On Saturday, 24 January 2015 at 21:00:06 UTC, Tobias Pankrath wrote:
>> On Saturday, 24 January 2015 at 20:49:03 UTC, Dominikus Dittes Scherkl
>> wrote:
>>> I would have no problem using an explicit cast, but where should I
>>> apply it?
>>
>> iota(0, 256).map!(x => foo(cast(ubyte) x))
> 
> Ok, thank you very much.
> 
> 4 times exactly the same answer - seems to be a common solution to a
> well known problem. :-/

people that are new to D aren't used to D lambdas, so it's fairly common. 
if you'll stay with D, you'll find yourself dreaming about such handy 
thing in another compiled languages very soon. ;-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20150124/93a4238e/attachment.sig>


More information about the Digitalmars-d-learn mailing list