title: increment all C++ std::vector values by a constant value
body: <p>I am trying to figure out what is the best way to increment all the elements of an <code>std::vector&lt;int&gt;</code> with a constant <code>int</code> value.</p>
  
  <p>In other words, if I have a vector with elements: <code>1 2 3 4 5</code></p>
  
  <p>I want to do something like</p>
  
  <pre><code>vect += 5;
  </code></pre>
  
  <p>So the elements will be: <code>6 7 8 9 10</code>.</p>
  
  <p>I tried to overload <code>operator +=</code> but it turns out I don't know how to do it :S I tried this:</p>
  
  <pre><code>std::vector&lt;int&gt; &amp; operator += (const int &amp; increment) {
      for (int &amp;i : *this)
          *this[i] = *this[i] + increment;
  }
  </code></pre>
  
  <p>And this compiles, but whenever I use it I get this error:</p>
  
  <pre><code>no match for ‘operator+=’ (operand types are ‘std::vector&lt;int&gt;’ and ‘int’)
   vec += 3;
          ^
  </code></pre>
  
  <p>Any advice? I would like to do it this way instead of a regular <code>increment(vector, value)</code> function.</p>
  
  <p>Thank you!</p>