title: Finding multiple max elements in a vector C++
body: <p>So.. I am trying to find the maximum value of a vector and its position in the vector. I am using a for loop, and it's working fine. My problem is, that if the maximum value appears more than once, I want to know all the positions in which it appears in the vector.. So, how could I manage this?
  So far, this is the code I am using: (the vector called v has elements that I read from a file but I will not add that part of the code)</p>
  
  <pre><code>std::vector&lt;double&gt;v;
  double maxvalue;
  int position=0;
  maxvalue = v[0];
  
  for (unsigned int i=0; i&lt;v.size(); i++){
      if (v[i]&gt; maxvalue){
          maxvalue=v[i];
          position= i;
      }
  }
  </code></pre>