Question about initialization

seany seany at uni-bonn.de
Fri Jun 4 11:27:05 UTC 2021


Consider initializing a dictionary or associative array :

     T[U] AA;

For example :

     double [int] AA;


This will be dynamic in size.

Now consider initializing a dynamic array :

     T[] A = new T[] (0);

or

     U[][] B = new U [][] (0,0);


This will also be dynamic in size.

In my untrained eye, this seems haphazard. One requires the use 
of the new keyword, the other does not. Why is it? Has It got 
something to do with random access mechanism? I would like to 
know the rationale please.


More information about the Digitalmars-d-learn mailing list