filtering a row of a jagged array
DanielG
simpletangent at gmail.com
Sun Aug 11 16:11:15 UTC 2019
int[][] whatever = [
[0],
[0, 1, 2],
[5, 6, 7, 8, 9, 10]
];
writeln(whatever[2]); // [5, 6, 7, 8, 9, 10]
writeln(typeid(whatever[2])); // int[]
auto x = whatever[2].filter(x => x > 7); // error
Error: template std.algorithm.iteration.filter cannot deduce
function from argument types !()(int[], void), candidates are: ...
Online example:
https://run.dlang.io/is/LUXFuF
...
I'm guessing I need to give the compiler some help understanding
that this is an array of ints, but 1) how, and 2) why? [if
typeid() seems to understand just fine?]
More information about the Digitalmars-d-learn
mailing list