Thank you guys, that's fantastic! I'll try out your functions.
Here's a modification to:
1) hide the intermediate struct (as usual in std.algorithm, I
forgot what this trick is called)
2) work with ranges, not just arrays (ie will work with iota, see
unittest)
3) accept input without "in" attribute;
4) accept arbitrary predicate, not just "==x"
Please co
Samuele Carcagno:
I would like to find the indexes of all the elements of an
array matching a certain value. I could simply loop over all
the elements to do the job, but I was hoping for some ready
made function that also works across different types (ints,
floats etc...).
I have written yo
I would like to find the indexes of all the elements of an array
matching a certain value. I could simply loop over all the
elements to do the job, but I was hoping for some ready made
function that also works across different types (ints, floats
etc...).
I saw the countUntil function in std.