Class-related queries [was: Re: 'Undefined reference' linking errors]
Joseph Wakeling
joseph.wakeling at gmail.com
Fri Apr 9 11:19:07 PDT 2010
> Also try:
>
> foreach(uint i;0..10000) {
> scope Foo f = new Foo(i);
> // Do something with f ...
> }
>
> That sometimes doesn't require allocations.
To be sure I understand -- is there anything wrong with writing
scope auto f = new Foo(i)
... or, in general, using auto to infer the class being initiated? I found myself
disliking the double writing of Foo, although I guess there could be a positive
side to it in ensuring that the class really is what it's meant to be.
More information about the Digitalmars-d-learn
mailing list