C++ Vector Iterator Syntax
#include <iostream>
#include <vector>
int main() {
std::vector<int> numbers = {1, 2, 3, 4, 5};
// Iterator pointing to the beginning of the vector
std::vector<int>::iterator it = numbers.begin();
// Iterate over the vector using the iterator
while (it != numbers.end()) {
// Access the element through the iterator
int value = *it;
// Print the current element
std::cout << value << " ";
// Move the iterator to the next element
++it;
}
return 0;
}