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