Standard Template Library – Iterators
You have a container with elements. How will you access it?? You need a hand to pick it up… Here, iterator is the thing which access the elements of a container. Features: It traverses the container and hides the internal structure. It supports find(),sort() and count() algorithms . It access the data as input,output. It can traverse in both forward and bidirectional. To access it, use container_type::iterator name. Let us create a c++ program to illustrate the iterators. #include <iostream> #include < vector > using namespace std; int main() { vector<int> v1 = {100,120,330,440,550}; // let us traverse the vector using iterator for (vector<int>::iterator i1 = v1.begin(); i1 != v1.end(); ++i1) cout << *i1 << " "; return 0; } Output: 100 12...