EquityZen Interview Question

What is an iterator?

Interview Answer

Anonymous

Mar 9, 2016

An iterator is a pointer-like object that can be incremented, and decremented, dereferenced, and compared to name a few of the supported operations. There are multiple types of iterators, that are named based on the type of operations they support. Forward iterators, backward iterators, and bi-directional iterators. Iterators are generated by the STL container member functions begin() and end(). Depending on the type of container, these member functions will return an iterator with the necessary functionality to work with that container.