Puzzle (8-14) (answer)

bearophile bearophileHUGS at lycos.com
Fri Aug 15 07:37:16 PDT 2008


Just for reference, all this stuff:

>                 arr = x in pairs;
>                 if (arr is null) {
>                     pairs[x] = new int[0];
>                     arr = x in pairs;
>                 }
>                 *arr ~= y;

Can be replaced with just:

pairs[x] ~= y;

Because arrays in D are structs, not referenced objects.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list