so I'm using this small function to print a vector. It works but I'm trying to understand how it works:
void const print_vector(vector<int> const& v)
{
std::for_each(v.begin(), v.end(), [](const int& n) {std::cout << n << " ";});
}
How does the "n" variable know to point to the element of the vector?
Any further corrections are appreciated as well
Thank you!