Insert an element into an Associative Array ?

Ary Manzana ary at esperanto.org.ar
Thu Apr 5 20:46:24 PDT 2012


On 4/5/12 2:57 AM, Chris Pons wrote:
> I'm playing around with associative arrays right now and I can't
> seem to figure out how to add additional objects to the array. I
> tried insert but it doesn't recognize both arguments.
>
> Also, if I do this it produces an error:
>
> Node[bool] test;
>
> Node node;
>
> Node[bool] temp = [ false:node ];
>
> test ~= temp;
>
>
> Error 1 Error: cannot append type Node[bool] to type
> Node[bool] C:\Users\CP\Documents\Visual Studio
> 2010\Projects\D\STDS\NPC.d 256
>
> Does this mean you can't use the append operator on associative
> arrays ? ( this one ~= ) ?

By the way, why is it called "associative array"? A name like Hash or 
Map would be much better. Everyone knows what a Hash means. I don't see 
anyone using "associative array" to refer to a Hash. And I think this is 
the source of the confusion Chris has...

I mean, you can't append to an associate array. What part of it makes it 
an "array"?


More information about the Digitalmars-d-learn mailing list