Implementing a tree with recursive Algebraic
Kamil Koczurek
koczurekk at gmail.com
Fri Jun 15 14:53:13 UTC 2018
Hi,
I'm trying to implement a simple tree and this 3-liner was my
initial idea:
struct Tree(T) {
Algebraic!(Tree, T)[] content;
}
But it doesn't work and I get the following error message:
/.../variant.d(...): Error: struct `app.Tree` no size because of
forward reference
/.../variant.d(...): Error: template instance
`std.variant.maxSize!(Tree, string)` error instantiating
source/app.d(10,3): instantiated from here:
`Algebraic!(Tree, string)`
Can I somehow fix this, or is my approach inherently flawed?
More information about the Digitalmars-d-learn
mailing list