On Friday, 20 April 2012 at 11:23:49 UTC, Steven Schveighoffer wrote:
On Fri, 20 Apr 2012 00:06:41 -0400, H. S. Teoh <hst...@quickfur.ath.cx> wrote:

The only complaint is that I couldn't write auto[string] dgs and have
the compiler auto-infer the delegate type. :-)

Does this not work?

auto dgs = ...

Also, it doesn't look like that needs to be in the inner loop. Each time you specify an AA literal, it allocates a new one. So you are allocating another AA literal per line.

-Steve

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?

Reply via email to