Random D geekout
Nick Sabalausky
SeeWebsiteToContactMe at semitwist.com
Fri Apr 20 12:00:47 PDT 2012
"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 ;)
More information about the Digitalmars-d
mailing list