https://issues.dlang.org/show_bug.cgi?id=16131

--- Comment #6 from Sobirari Muhomori <[email protected]> ---
Try this:

struct Foo {
    int x;
    Fiber fib;
    @disable this(this);
    void create(int x) {
        this.x = x;
        fib = new Fiber(&run);
    }
    void run() {
        writeln("Hello from: ", x);
    }
}

void main() {
    Foo[10] foos; // OR with:  = void;
    foreach(int i, ref foo; foos) {
        foo.create(i);
    }
    foreach(ref foo; foos) {
        foo.fib.call();
    }
}

--

Reply via email to