On Wednesday, 4 September 2019 at 06:20:00 UTC, berni wrote:
On Tuesday, 3 September 2019 at 20:06:27 UTC, Ferhat Kurtulmuş
wrote:
I know, it is foreach loop in question. How about using a
reverse for loop like:
for (size_t i = arr.length ; i-- > 0 ; ){
arr.remove(i);
}
This would be goo
On Tuesday, 3 September 2019 at 20:06:27 UTC, Ferhat Kurtulmuş
wrote:
I know, it is foreach loop in question. How about using a
reverse for loop like:
for (size_t i = arr.length ; i-- > 0 ; ){
arr.remove(i);
}
This would be good, if it where for slices. But with associative
arrays, this
On Thursday, 29 August 2019 at 10:11:58 UTC, berni wrote:
Iterating of some structure and removing elements thereby is
always errorprone and should be avoided. But: In case of AA,
I've got the feeling, that it might be safe:
foreach (k,v;ways)
if (v.empty)
ways.remove(k);
Do you
On Thursday, 29 August 2019 at 10:11:58 UTC, berni wrote:
Iterating of some structure and removing elements thereby is
always errorprone and should be avoided. But: In case of AA,
I've got the feeling, that it might be safe:
foreach (k,v;ways)
if (v.empty)
ways.remove(k);
Do you
On Fri, Aug 30, 2019 at 04:45:20PM +, berni via Digitalmars-d-learn wrote:
> On Friday, 30 August 2019 at 15:00:59 UTC, Paul Backus wrote:
> > Whether you actually get an error at runtime depends on the load
> > factor of the AA. If it drops below a certain threshold, the AA will
> > be resized
On Friday, 30 August 2019 at 15:00:59 UTC, Paul Backus wrote:
Whether you actually get an error at runtime depends on the
load factor of the AA. If it drops below a certain threshold,
the AA will be resized [1], and its original memory will be
freed [2].
It could still work, depending on how
On Friday, 30 August 2019 at 13:43:54 UTC, XavierAP wrote:
On Thursday, 29 August 2019 at 10:11:58 UTC, berni wrote:
Iterating of some structure and removing elements thereby is
always errorprone and should be avoided. But: In case of AA,
I've got the feeling, that it might be safe:
foreach
On Thursday, 29 August 2019 at 10:11:58 UTC, berni wrote:
Do you agree? Or is there a better way to achieve this?
An alternative would be to reassign the AAA to the output of
std.algorithm.filter()... but assignment between AAs and Ranges
isn't so type-direct.
On Thursday, 29 August 2019 at 10:11:58 UTC, berni wrote:
Iterating of some structure and removing elements thereby is
always errorprone and should be avoided. But: In case of AA,
I've got the feeling, that it might be safe:
foreach (k,v;ways)
if (v.empty)
ways.remove(k);
Do you
On Thursday, August 29, 2019 4:11:58 AM MDT berni via Digitalmars-d-learn
wrote:
> Iterating of some structure and removing elements thereby is
> always errorprone and should be avoided. But: In case of AA, I've
>
> got the feeling, that it might be safe:
> > foreach (k,v;ways)
> >
> > if (v.e
Iterating of some structure and removing elements thereby is
always errorprone and should be avoided. But: In case of AA, I've
got the feeling, that it might be safe:
foreach (k,v;ways)
if (v.empty)
ways.remove(k);
Do you agree? Or is there a better way to achieve this?
11 matches
Mail list logo