What is the difference between
void printVector ( std::vector<int> & v ) {
for ( auto &i : v )
std::cout << i << std::endl;
}
void printVector ( std::vector<int> & v ) {
for ( auto i : v )
std::cout << i << std::endl;
}
I'm curious about the &
before i:
- Does it have to be there ( even thought it works the same in both cases ) ?
- What does it do?