title: Update each value in a std::list with a foreach loop C++
body: <p>I've got a <code>std::list</code> in C++ and I'm trying to use a 
  <code>for(Type t : list)</code>
  operation to update the value of each object. So I have a list called balls and each ball has a position. My code to for the loop is:</p>
  
  <pre><code>for(OpenGLView::AssetInstance ball : balls)
              ball.position = calculateBallPosition(ball);
  </code></pre>
  
  <p>where calculateBallPosition takes a ball and returns its new position based on time elapsed.</p>
  
  <p>The problem I am running into is that the value of the elements in the list don't seem to be updating. When I check their values after the loop has run, it's the same as it was before. I'm guessing my mistake is in understanding the way this loop works, but I haven't been able to figure out how to fix it.</p>