no size yet for forward reference for nested structures

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Wed Jan 14 07:39:21 PST 2015


On Wed, 14 Jan 2015 07:09:44 -0800
Ali Çehreli via Digitalmars-d <digitalmars-d at puremagic.com> wrote:

> Reduced:
> 
> import std.container;
> 
> class Node
> {
>      SList!Node children;
> }
> 
> void main()
> {}
> 
> Error: class deneme.Node no size yet for forward reference
> 
> I wonder why an SList of a reference type requires the size of the 
> elements? The following compiles but is that a pointer to a class 
> variable or a class object? How can we even use the 'children' member?
> 
>      SList!(Node*) children;

i don't know: i've never used `std.container` anyway. ;-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20150114/eb8dbb89/attachment.sig>


More information about the Digitalmars-d mailing list