lazy thoughts

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Jan 12 13:29:06 PST 2009


noobie wrote:
> 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?

Efficiency. You'd have to copy the whole range, and in fact deep copy it.

Andrei



More information about the Digitalmars-d mailing list