C++ Input IteratorLast Updated : 17 Mar 2025
Where 'X' is of input iterator type while 'a' and 'b' are the objects of an iterator type. Features of Input iterator:
Let's see a simple example: Output: Both the iterators are not equal In the above example, itr and itr1 are the two iterators. Both these iterators are of vector type. The 'itr' is an iterator object pointing to the first position of the vector and 'itr1' is an iterator object pointing to the second position of the vector. Therefore, both the iterators point to the same location, so the condition itr1!=itr returns true value and prints "Both the iterators are not equal".
Let's see a simple example: Output: 11 In the above example, 'it' is an iterator object pointing to the first element of a vector 'v'. A dereferencing an iterator *it returns the value pointed by the iterator 'it'.
Let's see a simple example: Output: 22 11 In the above example, 'it' and 'it1' iterators are swapped by using an object of a third iterator, i.e., temp. Next Topic |
We request you to subscribe our newsletter for upcoming updates.

We deliver comprehensive tutorials, interview question-answers, MCQs, study materials on leading programming languages and web technologies like Data Science, MEAN/MERN full stack development, Python, Java, C++, C, HTML, React, Angular, PHP and much more to support your learning and career growth.
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India