lazy thoughts

BCS ao at pathlink.com
Mon Jan 12 11:59:00 PST 2009


Reply to noobie,

> Andrei Alexandrescu Wrote:
> 
>> int[] arr = [ 1, 2, 3, 4 ];
>> auto squares = map!("a * a")(arr);
>> arr[] = [ 5, 6, 7, 8 ];
>> Now iterating squares will see different numbers than the original
>> ones.
>> 
> Okay, what is the problem in maintaining a reference to the original
> array values?
> 

that is the problem. "arr[]" is a content copy not a reference copy.





More information about the Digitalmars-d mailing list