Automatic Inference for Both Key and Value Types of an Associative Array

bearophile via Digitalmars-d digitalmars-d at puremagic.com
Fri Aug 15 02:17:45 PDT 2014


Kenji Hara:

> I implemented partial type deduction in AA keys.
> https://github.com/D-Programming-Language/dmd/pull/3615
>
> For example:
>     auto[auto[$]] aa5 = [[1,2]:1, [3,4]:2];
>     static assert(is(typeof(aa5) == int[int[2]]));
>
>     int[int[][$]] aa15 = [[[1],[2]]:1, [[3],[4]]:2];
>     static assert(is(typeof(aa15) == int[int[][2]]));
>
> Kenji Hara

Looks nice. Thank you.
D type system will slowly get better and better.

Bye,
bearophile


More information about the Digitalmars-d mailing list