foreach (i; 0..5) {
immutable int j = i;
etc.
}
I want each j to be assigned separate memory so that it can be
passed to a calle function and not overwritten by next value of i
in foreach()??
On Friday, 13 November 2015 at 15:49:01 UTC, Ish wrote:
foreach (i; 0..5) {
immutable int j = i;
etc.
}
I want each j to be assigned separate memory so that it can be
passed to a calle function and not overwritten by next value of
i in foreach()??
Just like in C, you'll have to allocate
On 11/13/15 10:48 AM, Ish wrote:
foreach (i; 0..5) {
immutable int j = i;
etc.
}
I want each j to be assigned separate memory so that it can be passed to
a calle function and not overwritten by next value of i in foreach()??
This is not safe to do. What you are doing is passing a scope-a
On Friday, 13 November 2015 at 16:06:51 UTC, Alex Parrill wrote:
On Friday, 13 November 2015 at 15:49:01 UTC, Ish wrote:
foreach (i; 0..5) {
immutable int j = i;
etc.
}
I want each j to be assigned separate memory so that it can be
passed to a calle function and not overwritten by next val
On Friday, 13 November 2015 at 17:44:31 UTC, Ish wrote:
On Friday, 13 November 2015 at 16:06:51 UTC, Alex Parrill wrote:
On Friday, 13 November 2015 at 15:49:01 UTC, Ish wrote:
foreach (i; 0..5) {
immutable int j = i;
etc.
}
I want each j to be assigned separate memory so that it can
be p
On 13.11.2015 18:44, Ish wrote:
immutable int* j = new immutable int(i);
gives error:
locks1.d:27: error: no constructor for immutable(int);
Looks like your D version is rather old. I had to go back to dmd 2.065
to see that error. 2.065 is from February 2014. We're at 2.069 now. I'd
recommend
On Friday, 13 November 2015 at 18:10:38 UTC, Marc Schütz wrote:
On Friday, 13 November 2015 at 17:44:31 UTC, Ish wrote:
On Friday, 13 November 2015 at 16:06:51 UTC, Alex Parrill
wrote:
[...]
immutable int* j = new immutable int(i);
gives error:
locks1.d:27: error: no constructor for immutable