Iterators in c++
c++ provides STL iterators and allocators which are mainly used to construct a generic algorithm. elements of the container can be accessed easily and effectively through iterators. iterators are objects that behave a lot like pointers. A typical iterator is an object of a class declared inside of a container class. the iterator overloads pointer operators such as the increment operator ++. the decrement operator --, and the dereferencing operator * in order to provide pointer like behaviour. the STL provides five iterator types, namely, forward, bidirectional, randomaccess, input and output.
the header file #include<iterator.h> must be included to use iterators.
the header file defines the iterator primitives, predefined iterators and streamiterators, as well as several supporting templates. the predefined iterators include insert and reverse adapters. there are three classes of insert iterator adaptors: front, back and general.
the header file #include<iterator.h> must be included to use iterators.
the header file defines the iterator primitives, predefined iterators and streamiterators, as well as several supporting templates. the predefined iterators include insert and reverse adapters. there are three classes of insert iterator adaptors: front, back and general.