This question already has an answer here:
I have been using std::max_element(vec), but it returns only one index(ie smallest index)
Example:
vector<int> v = {1, 2, 3, 4, 5, 3, 3, 2, 5};
std::max_element(v) would reference v[4], but I want indices of all max elements. What would be the best way to do this?
Aucun commentaire:
Enregistrer un commentaire