Find indexes of elements matching a given value in an array

Samuele Carcagno sam.carcagno at gmail.com
Sun Sep 9 16:35:55 PDT 2012


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.algorithm, but that gives me 
only the index of the first match, while I would like to get an 
array with the indexes of all the matches. Is there any function 
for that purpose?

Thanks for any help!


More information about the Digitalmars-d-learn mailing list