title: How to apply C++ std algorithms in this context?
body: <p>I'm learning c++ and I would like to know how I can improve the following code: </p>
  
  <pre><code>std::vector&lt;float&gt; distances;
  std::for_each(play_-&gt;get_emps().begin(), play_-&gt;get_emps().end(), [distances, tank] (const auto&amp; e) {
      distances.push_back(math::distance(e.location(), tank-&gt;location()));
  });
  </code></pre>
  
  <p>There must be a better way to fill a vector with std::algorithms?</p>