On Tuesday, 21 June 2016 at 19:33:31 UTC, cym13 wrote:
... but “trackTemplates[0].coords = [{0, 9}, {1, 1},
{3, 6}];” is an assignment so the compiler can infer as much and doesn't understand that each of those list of values are really CoordLists.

I see, but it seems a bit strange given that they are being assigned to .coords[] which is already defined as of type CoordList.

trackTemplates[0].coords = [CoordList(0, 9), CoordList(1, 1), CoordList(3, 6)];” would have worked as expected.

I'd want to avoid this wordy explicit way as the list can extend to several hundred pairs. Most likely I need a better way to store the information.

@ketmar:

Why is initialisation via {} bad (in simple terms please :D)? I noticed while working on this bit of code that I could initialise simple struct variables with {} but couldn't do the same with an array of structs. I guess this is for the same or similar reason to the above.

Thanks both for the help.

Reply via email to