On Monday, 21 June 2021 at 03:59:10 UTC, someone wrote:
I often need to iterate through a filtered collection
(associative array) as following:
```d
string strComputerIDunwanted = "WS2"; /// associative array key
to exclude
foreach (strComputerID, udtComputer; udtComputers) { ///
.remove!(a => a == strComputerIDunwanted) ... ?
if (strComputerID != strComputerIDunwanted) {
...
}
}
```
Is there a way to filter the collection at the foreach-level to
avoid the inner if ?
something like this ?
``` D
import std.array;
import std.algorithm;
udtComputers.byPair
.filter!(p => p.key != strComputerIDunwanted)
.each!( (p) { /* foreach body */ } );
```