DIP for multiple auto ref values
Timon Gehr
timon.gehr at gmx.ch
Tue Apr 9 21:13:57 UTC 2019
On 09.04.19 23:07, Timon Gehr wrote:
> ...
>
> 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]);
> }
> ---
And if you want it to compile on 64 bits:
---
import std.range, std.algorithm; // (need to be changed)
void main(){
size_t[] a=[1,2,3,4,5];
foreach((i,ref j);enumerate(a)){
j=i;
}
assert(a==[0,1,2,3,4]);
}
---
(I have sent this message before, but it does not seem to have made it
to the server. I'm sorry if this is a double-post.)
More information about the Digitalmars-d
mailing list