fibers and ranges: what's wrong here?
zeljkog via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Dec 13 04:26:46 PST 2014
On 13.12.14 13:01, zeljkog wrote:
>
> void main() {
> auto tt = Tree(5, [Tree(7,[Tree(11), Tree(4)]), Tree(10)]);
> auto tr1 = TreeRange(tt);
> foreach(v; tr1){
> writef("%2d, ", v);
> }
> writeln();
> for(auto r = TreeRange(tt); !r.empty; r.popFront())
> writef("%2d, ", r.front);
> writeln();
> }
>
Sorry, this works:
void main() {
auto tt = Tree(5, [Tree(7,[Tree(11), Tree(4)]), Tree(10)]);
foreach(v; TreeRange(tt)){
writef("%2d, ", v);
}
writeln();
for(auto r = TreeRange(tt); !r.empty; r.popFront())
writef("%2d, ", r.front);
writeln();
}
I needed this:
struct TreeRange{
this (this){ throw new Exception("TreeRange is noncopyable!"); }
...
}
Or use class :)
More information about the Digitalmars-d-learn
mailing list