Forward Reference

Njkp via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Oct 9 12:26:18 PDT 2014


On Thursday, 9 October 2014 at 19:04:56 UTC, Anibal wrote:
> Hi everyone,
>
> I'm trying to something like a tree structure.
>
> The following:
>
> import std.container;
> class Tree
> {
>         private SList!Tree subTree;
> }
>
> Produces: class Tree no size yet for forward reference.
>
> How i should proceed in order to keep this declaration?
>
> Thanks a lot!
>
> PD: (You guys are incredibly quick to answer, that's awesome!)

make a pointer list instead, which has a fixed size:
---
import std.container;
class Tree
{
         private SList!(Tree*) subTree;
}
---


More information about the Digitalmars-d-learn mailing list