Re: std.container.array of struct inside a struct fails

2017-07-14 Thread drug via Digitalmars-d-learn
14.07.2017 19:53, Anton Fediushin пишет: On Friday, 14 July 2017 at 16:42:59 UTC, drug wrote: It's because Array(T) is a value type and needs type size to define itself, so you have expected forward reference. But T[] is reference type and its size is known in advance - it doesn't depend on

Re: std.container.array of struct inside a struct fails

2017-07-14 Thread Anton Fediushin via Digitalmars-d-learn
On Friday, 14 July 2017 at 16:42:59 UTC, drug wrote: It's because Array(T) is a value type and needs type size to define itself, so you have expected forward reference. But T[] is reference type and its size is known in advance - it doesn't depend on type, it's always pointer.sizeof +

Re: std.container.array of struct inside a struct fails

2017-07-14 Thread drug via Digitalmars-d-learn
14.07.2017 19:12, Anton Fediushin пишет: This code: - import std.container.array; struct Test { Array!Test t; } - Fails with an error: - /usr/include/dlang/dmd/std/traits.d(2404): Error: struct arrayissue.Test no size because of forward reference It's because Array(T) is a

std.container.array of struct inside a struct fails

2017-07-14 Thread Anton Fediushin via Digitalmars-d-learn
This code: - import std.container.array; struct Test { Array!Test t; } - Fails with an error: - /usr/include/dlang/dmd/std/traits.d(2404): Error: struct arrayissue.Test no size because of forward reference /usr/include/dlang/dmd/std/traits.d(3462): Error: template instance