// Using a for loop with iterator for(std::vector<int>::iterator it = std::begin(v); it != std::end(v); ++it) { std::cout << *it << " "; }