DIP for multiple auto ref values
Timon Gehr
timon.gehr at gmx.ch
Tue Apr 9 21:07:32 UTC 2019
On 09.04.19 23:05, Timon Gehr wrote:
> ---
> import std.range, std.algorithm; // (need to be changed)
> void main(){
> auto a=[1,2,3,4,5];
> foreach((i,ref j);enumerate(a)){
> a[i]=i;
> }
> assert(a==[0,1,2,3,4]);
> }
> ---
Obviously, this should have been:
---
import std.range, std.algorithm; // (need to be changed)
void main(){
auto a=[1,2,3,4,5];
foreach((i,ref j);enumerate(a)){
j=i;
}
assert(a==[0,1,2,3,4]);
}
---
More information about the Digitalmars-d
mailing list