no size yet for forward reference for nested structures
qqiang via Digitalmars-d
digitalmars-d at puremagic.com
Wed Jan 14 02:41:07 PST 2015
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 replace the SList with a dynamic array?
>
> Bye,
> bearophile
Thanks for your reply.
I'm sorry that I've provided wrong code. This is the exact code:
-------------------------------------------------------------------
template PowerHeap(T) {
import std.container : SList;
private alias PowerForest = SList!PowerNode;
private final class PowerNode {
private {
T payload_;
uint rank_;
PowerForest children_;
}
}
final class PowerHeap {
private {
PowerNode top_;
PowerForest forest_;
uint size_;
}
}
}
unittest {
PowerHeap!int h;
}
----------------------------------------------------------------------
My compiler is v2.066.1
More information about the Digitalmars-d
mailing list