讓我解釋 '這' 的功能是什麼:是否有在C/C++相同功能以GNU-R,其中()?
從GNU-R幫助:
該指數是正確的?
給一個邏輯對象的「TRUE」的索引,從而允許陣列索引。
或示出某些代碼:(GNU-R開始計數索引與1)
> x <- c(1,2,3,1,3,5);
> which(x == 1);
[1] 1 4
> which(x == 3);
[1] 3 5
> ll <- c(TRUE,FALSE,TRUE,NA,FALSE,FALSE,TRUE);
> which(ll);
[1] 1 3 7
沒有人知道在C/C類似的功能++?
感謝您的幫助
rinni
['std :: find_if'](http://en.cppreference.com/w/cpp/algorithm/find)或['std :: copy_if'](http://en.cppreference.com/ w/cpp/algorithm/copy)取決於你想要用它做什麼。 (或其他幾個圖書館電話) – 2012-12-20 17:40:57