title: Updating all elements in a C++ vector
body: <p>I have a vector of structs - say the struct is something like:</p>
  
  <pre><code>struct foo {
    int bar1;
    int bar2;
  }
  </code></pre>
  
  <p>Now I want to update each element of my vector and the update is multiplying <code>bar1</code> by 2.</p>
  
  <p>The naive way to do this would be to iterate over each element of the vector, but is there a better way of doing this, maybe by using a library function with a c++11 lambda function?</p>