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

Thanks.

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

Yao G. <nospam...@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/

Reply via email to