title: Smart way of assigning single member from vector A to vector B
body: <p>This is a piece of code I'm currently using and I was wondering if there was a more elegant way of doing this in C++11 - </p>
  
  <p>Essentially <code>vector_a</code> is copied to <code>vector_b</code>, then slightly modified, then <code>vector_b</code> is returned.</p>
  
  <p>Vector elements are of class <code>Point</code> which is basically (leaving out constructors and a bunch of methods):</p>
  
  <pre><code>class Point {
      double   x,
               y,
               z;
  };
  </code></pre>
  
  <p>Ideally I'd love to boil down the assignment of member <code>z</code> from <code>vector_a</code> to <code>vector_b</code> to something like a line or two but couldn't come up with an elegant way of doing it.</p>
  
  <p>Any suggestions welcome!</p>
  
  <pre><code>auto localIter = vector_a.begin();
  auto outIter = vector_b.begin();
  while (localIter != vector_a.end() &amp;&amp; outIter != vector_b.end())
  {
      outIter-&gt;z = localIter-&gt;z;
      localIter++;
      outIter++;
  }
  </code></pre>