digitalmars.D.learn - Question about initialization
- seany (14/14) Jun 04 2021 Consider initializing a dictionary or associative array :
- Adam D. Ruppe (4/6) Jun 04 2021 It doesn't.
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.
Jun 04 2021
On Friday, 4 June 2021 at 11:27:05 UTC, seany wrote:In my untrained eye, this seems haphazard. One requires the use of the new keywordIt doesn't. T[] a; just works. it is an array of length 0.
Jun 04 2021