title: Using the Lambda Function with Objects and for_each loops
body: <p>I'm trying to better understand a few fundamental concepts about working with the lambda functions with a vector of objects and <code>std::for_each()</code> loops.</p>
  
  <p>I'm attempting to pass the <code>const int</code> contents of <code>someObjectVector.end()-&gt;someObjectVectorMethod()</code> into <code>i</code>, but just can't find a way to make it happen.</p>
  
  <p>I also want to use those iterators to set the parameters of the <code>std::for_each()</code> loop. Is this just not possible, or am I approaching this the wrong way syntactically?</p>
  
  <pre><code>std::for_each(someObjectVector.begin()-&gt;someObjectVectorMethod(), (someObjectVector.end()-&gt;getSomeObjectVectorData(), [&amp;](int i)
  {
      someObjectVector[0].setSomeObjectVectorDate() + i;
  });
  </code></pre>