std.container.array: Error: unable to determine fields of Test because of forward references

Tobias Pankrath tobias at pankrath.net
Thu Oct 31 12:29:28 UTC 2019


My Problem:

--- (https://run.dlang.io/is/CfLscj)
import std.container.array;
import std.traits;

struct Test
{
    Test[] t;
}

struct Test2
{
    Array!Test2 t;
}

int main()
{
	return FieldTypeTuple!Test.length + FieldTypeTuple!Test2;
}
---

I've found https://issues.dlang.org/show_bug.cgi?id=19407 but I 
am not using separate compilation, just `dmd test.d`.

I want to have a tree structure like

---
struct S
{
     S[] children;
}
---

but I do not want to rely on the GC and thus wanted to use a 
custom array type. What's the best way to do this?


More information about the Digitalmars-d-learn mailing list