Random D geekout

Arne arne at linux.nu
Sat Apr 21 02:22:41 PDT 2012


On Friday, 20 April 2012 at 19:00:29 UTC, Nick Sabalausky wrote:
> "Arne" <arne at linux.nu> wrote in message
> news:qmehxgyksrdxkabvcyiv at forum.dlang.org...
>>
>> auto dgs =
>> [
>>   "name":  (string value) {d.name = value; },
>>   "phone": (string value) => cast(void)(d.phone = value),
>>   "age":   (string value) => cast(void)(d.age   = 
>> value.to!int()),
>> ];
>>
>> This works... is there a better way, to avoid cast?
>>
>
> Yes: Don't use the lambda syntax when it's not a lambda ;)

But... but... that sounds entirely too reasonable! ;)


More information about the Digitalmars-d mailing list