Class-related queries [was: Re: 'Undefined reference' linking errors]

bearophile bearophileHUGS at lycos.com
Fri Apr 9 09:14:27 PDT 2010


Joseph Wakeling:
> ... when it reappears in D as:
> 
>     foreach(uint i;0..10000) {
>         auto f = new Foo(i);
>         // Do something with f ...
>     }

Also try:

foreach(uint i;0..10000) {
    scope Foo f = new Foo(i);
    // Do something with f ...
}

That sometimes doesn't require allocations.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list