August 09, 2019
https://issues.dlang.org/show_bug.cgi?id=9740

Simen Kjaeraas <simen.kjaras@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |simen.kjaras@gmail.com
         Resolution|---                         |INVALID

--- Comment #3 from Simen Kjaeraas <simen.kjaras@gmail.com> ---
The map function changes the contents of the array, and unsurprisingly, that changes what the filter filters. This is not a bug in filter and map, but in your code.

Reduced example:

    auto arr = [[false]];

    writeln(arr.filter!(a =>  a[0]).map!(a => a[0] = true)); // []
    writeln(arr.filter!(a => !a[0]).map!(a => a[0] = true)); // [true]
    writeln(arr.filter!(a =>  a[0]).map!(a => a[0] = true)); // [false]

This is possibly caused by a misguided idea that the array is a value type.

--