data containers

Moritz mpipahl at gspgmbh.com
Thu Jul 3 16:08:43 PDT 2008


torhu schrieb:
> Does it work if you make this change?
> 
> -     if(layer <= layer_count)
> +     if(layer < layer_map.length)

Well, my program DOES work, but I doesnt do what I want it to, because 
Im now unable to insert ScreenElements into the array.

Do I need to initialize the array slots before I assign an object to 
them? The way I see it, the array has length 0 at start, and I cant put 
anything in slot 0 or Ill get an array out of bounds error :-(

My problem is I dont know how to store the ScreenElement instances into 
the array.

I guess my next problem after storing them will be to keep the garbage 
collector from deleting them after I leave the function where the 
ScreenElements  are created and stored into the array, or does the array 
reference protect the ScreenElements from GC?.


More information about the Digitalmars-d-learn mailing list