D and a bazillion of small objects

Yao G. nospamyao at gmail.com
Wed Jun 2 21:03:53 PDT 2010

Yeah. I think I'll do that. I just hope that no temporary copy is created  
in other item access or manipulation.


On Wed, 02 Jun 2010 20:04:53 -0500, Simen kjaeraas  
<simen.kjaras at gmail.com> wrote:

> Yao G. <nospamyao at gmail.com> wrote:
>> Thanks bearophile.
>> With respect to passing structs as reference, I also have this problem.  
>> In the widget, I have a opIndex method, that returns a ListViewItem  
>> given an index (like an array). When opIndex return the instance I'm  
>> looking for, and then I modify some property (a image index, for  
>> example) the change is only visible in the returned copy, but the  
>> internal instance, the one stored in the collection (array in this  
>> case) is not modified.
> So use a ref return.
> ref T opIndex( int index ) {
>    return arr[index];
> }

Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

More information about the Digitalmars-d-learn mailing list