Standalone AA implementation ready for review (Was: Re: Replacing AA's in druntime)

Steven Schveighoffer schveiguy at yahoo.com
Thu Mar 15 10:44:15 PDT 2012


On Thu, 15 Mar 2012 13:39:19 -0400, Steven Schveighoffer  
<schveiguy at yahoo.com> wrote:

> On Thu, 15 Mar 2012 13:24:24 -0400, Andrei Alexandrescu  
> <SeeWebsiteForEmail at erdani.org> wrote:
>> What would that look like?
>
> auto aa = [1:1];
>
>   becomes:
>
> int[1] __k = [1]; // obviously, no heap allocation should happen here,  
> that needs fixing in the compiler
> int[1] __v = [1];
> auto aa = AssociativeArray!(int, int)(__k, __v); // same instantiation,  
> no matter how many elements are in literal.

Sorry, that should really be:

auto aa = AssociativeArray!(int, int)(__k[], __v[]);

-Steve


More information about the Digitalmars-d mailing list