Re: no size yet for forward reference for nested structures

2015-01-16 Thread Steven Schveighoffer via Digitalmars-d
On 1/16/15 2:18 AM, zeljkog wrote: On 16.01.15 08:04, zeljkog wrote: On 15.01.15 23:30, Steven Schveighoffer wrote: On 1/15/15 9:56 AM, zeljkog wrote: This compiles: import std.container; class Node { DList!Node children; } Then use DList? DList is not SList, they were written by

Re: no size yet for forward reference for nested structures

2015-01-16 Thread Steven Schveighoffer via Digitalmars-d
On 1/16/15 1:24 PM, Steven Schveighoffer wrote: I will file a bug. Thanks for digging into this. https://issues.dlang.org/show_bug.cgi?id=13990 https://github.com/D-Programming-Language/phobos/pull/2876 -Steve

Re: no size yet for forward reference for nested structures

2015-01-15 Thread Ali Çehreli via Digitalmars-d
On 01/15/2015 06:56 AM, zeljkog wrote: This compiles: import std.container; class Node { DList!Node children; } So does using an 'interface', which may be more desirable in some cases: import std.container; interface Iface {} class Node : Iface { SList!Iface children; } void

Re: no size yet for forward reference for nested structures

2015-01-15 Thread zeljkog via Digitalmars-d
This compiles: import std.container; class Node { DList!Node children; }

Re: no size yet for forward reference for nested structures

2015-01-15 Thread Steven Schveighoffer via Digitalmars-d
On 1/15/15 9:56 AM, zeljkog wrote: This compiles: import std.container; class Node { DList!Node children; } Then use DList? DList is not SList, they were written by different people. -Steve

Re: no size yet for forward reference for nested structures

2015-01-15 Thread zeljkog via Digitalmars-d
On 15.01.15 23:30, Steven Schveighoffer wrote: On 1/15/15 9:56 AM, zeljkog wrote: This compiles: import std.container; class Node { DList!Node children; } Then use DList? DList is not SList, they were written by different people. -Steve SList.Range has moveFront, DList.Range does

Re: no size yet for forward reference for nested structures

2015-01-15 Thread zeljkog via Digitalmars-d
On 16.01.15 08:04, zeljkog wrote: On 15.01.15 23:30, Steven Schveighoffer wrote: On 1/15/15 9:56 AM, zeljkog wrote: This compiles: import std.container; class Node { DList!Node children; } Then use DList? DList is not SList, they were written by different people. -Steve

Re: no size yet for forward reference for nested structures

2015-01-15 Thread Steven Schveighoffer via Digitalmars-d
On 1/14/15 10:09 AM, Ali Çehreli wrote: On 01/14/2015 02:53 AM, ketmar via Digitalmars-d wrote: On Wed, 14 Jan 2015 10:41:07 + qqiang via Digitalmars-d digitalmars-d@puremagic.com wrote: template PowerHeap(T) { import std.container : SList; private alias

Re: no size yet for forward reference for nested structures

2015-01-14 Thread Ali Çehreli via Digitalmars-d
On 01/14/2015 07:39 AM, ketmar via Digitalmars-d wrote: On Wed, 14 Jan 2015 07:09:44 -0800 Ali Çehreli via Digitalmars-d digitalmars-d@puremagic.com wrote: Reduced: import std.container; class Node { SList!Node children; } void main() {} Error: class deneme.Node no size yet for

Re: no size yet for forward reference for nested structures

2015-01-14 Thread Ali Çehreli via Digitalmars-d
On 01/14/2015 02:53 AM, ketmar via Digitalmars-d wrote: On Wed, 14 Jan 2015 10:41:07 + qqiang via Digitalmars-d digitalmars-d@puremagic.com wrote: template PowerHeap(T) { import std.container : SList; private alias PowerForest = SList!PowerNode; private final class

Re: no size yet for forward reference for nested structures

2015-01-14 Thread ketmar via Digitalmars-d
On Wed, 14 Jan 2015 07:09:44 -0800 Ali Çehreli via Digitalmars-d digitalmars-d@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

Re: no size yet for forward reference for nested structures

2015-01-14 Thread bearophile via Digitalmars-d
qqiang: I've googled and found no straightforward solution to this issue. The how can I modify my code to eliminate this error? Your code gives me a different error (Error: PowerHeap!int is used as a type). What if you replace the SList with a dynamic array? Bye, bearophile

Re: no size yet for forward reference for nested structures

2015-01-14 Thread Ali Çehreli via Digitalmars-d
First a reminder that this sort of question is more suitable to the D.learn newsgroup. On 01/13/2015 10:41 PM, qqiang wrote: The following code: ```D template PowerHeap(T) { import std.container : SList; private alias PowerForest = SList!PowerNode; private final class

Re: no size yet for forward reference for nested structures

2015-01-14 Thread ketmar via Digitalmars-d
On Wed, 14 Jan 2015 10:41:07 + qqiang via Digitalmars-d digitalmars-d@puremagic.com wrote: template PowerHeap(T) { import std.container : SList; private alias PowerForest = SList!PowerNode; private final class PowerNode { private { T payload_;

Re: no size yet for forward reference for nested structures

2015-01-14 Thread qqiang via Digitalmars-d
On Wednesday, 14 January 2015 at 08:31:08 UTC, bearophile wrote: qqiang: I've googled and found no straightforward solution to this issue. The how can I modify my code to eliminate this error? Your code gives me a different error (Error: PowerHeap!int is used as a type). What if you

Re: no size yet for forward reference for nested structures

2015-01-14 Thread qqiang via Digitalmars-d
On Wednesday, 14 January 2015 at 08:31:13 UTC, Ali Çehreli wrote: First a reminder that this sort of question is more suitable to the D.learn newsgroup. On 01/13/2015 10:41 PM, qqiang wrote: The following code: ```D template PowerHeap(T) { import std.container : SList; private

no size yet for forward reference for nested structures

2015-01-13 Thread qqiang via Digitalmars-d
The following code: ```D template PowerHeap(T) { import std.container : SList; private alias PowerForest = SList!PowerNode; private final class PowerNode { ... } final class PowerHead { ... } } unittest { PowerHeap!int h; } ``` failed to compile