Constructing arrays of structs

Danilo codedan at aol.com
Tue Jan 23 23:40:04 UTC 2024


On Tuesday, 23 January 2024 at 18:15:29 UTC, Stephen Tashiro 
wrote:
> If the constructor of a class needs to create an array of 
> structs whose dimensions are inputs, what's the syntax for 
> doing this?
>
> For a non-example, the following program errors in main() 
> because in t.array[][] "index [0] is out of bounds".

You need to remove `auto` from
`auto array = new Point[][](the_dimension,the_dimension);`
because it creates a new variable.


More information about the Digitalmars-d-learn mailing list