The C++ Standard Library
- C++ Library - <valarray>
- C++ Library - <utility>
- C++ Library - <typeinfo>
- C++ Library - <tuple>
- C++ Library - <thread>
- C++ Library - <string>
- C++ Library - <stdexcept>
- C++ Library - <regex>
- C++ Library - <numeric>
- C++ Library - <new>
- C++ Library - <memory>
- C++ Library - <locale>
- C++ Library - <limits>
- C++ Library - <functional>
- C++ Library - <exception>
- C++ Library - <complex>
- C++ Library - <atomic>
- C++ Library - <streambuf>
- C++ Library - <sstream>
- C++ Library - <ostream>
- C++ Library - <istream>
- C++ Library - <iostream>
- C++ Library - <iosfwd>
- C++ Library - <ios>
- C++ Library - <iomanip>
- C++ Library - <fstream>
- C++ Library - Home
The C++ STL Library
- C++ Library - <iterator>
- C++ Library - <algorithm>
- C++ Library - <vector>
- C++ Library - <unordered_set>
- C++ Library - <unordered_map>
- C++ Library - <stack>
- C++ Library - <set>
- C++ Library - <queue>
- C++ Library - <map>
- C++ Library - <list>
- C++ Library - <forward_list>
- C++ Library - <deque>
- C++ Library - <bitset>
- C++ Library - <array>
C++ Programming Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
C++ Library - <iterator>
Introduction
It is a pointer-pke object that can be incremented with ++, dereferenced with *, and compared against another iterator with !=
Categories
category | properties | vapd expressions | |||
---|---|---|---|---|---|
all categories | copy-constructible, copy-assignable and destructible |
b = a; |
|||
It can be incremented |
a++ |
||||
Random Access | Bidirectional | Forward | Input | It supports equapty/inequapty comparisons |
a != b |
It can be dereferenced as an rvalue | *a a->m |
||||
Output | It can be dereferenced as an lvalue (only for mutable iterator types) |
*a = t *a++ = t |
|||
default-constructible | X a; X() |
||||
Multi-pass: neither dereferencing nor incrementing affects dereferenceabipty | { b = a; *a++; *b; } |
||||
It can be decremented | --a a-- *a-- |
||||
It supports arithmetic operators + and - | a + n n + a a - n a - b |
||||
It supports inequapty comparisons ( <, >, <= and >=) between iterators | a < b a > b a <= b a >= b |
||||
It supports compound assignment operations += and -= | a += n a -= n |
||||
It supports offset dereference operator ([]) | a[n] |
Functions
Sr.No. | Functions & Description |
---|---|
1 | It advances the iterator it by n element positions. |
2 | It returns distance between iterators. |
3 | It is used to begin an iterator. |
4 | It is used to end an iterator. |
5 | It is used to get iterator to previous element. |
6 | It is used to get iterator to next element. |
Iterator generators
Sr.No. | Iterator generators & Description |
---|---|
1 | It constructs back insert iterator. |
2 | It constructs insert iterator |
3 | It construct move iterators. |
Classes
Sr.No. | Classes & Description |
---|---|
1 | It iterators base class. |
2 | It is an iterator traits. |
Predefined iterators
Sr.No. | Predefined iterators & Description |
---|---|
1 | It is a reverse iterator. |
2 | It is a move iterator. |
3 | It is a back insert iterator. |
4 | It is a front insert iterator. |
5 | It is used to insert an iterator. |
6 | It is an input stream iterator. |
7 | It is an output stream iterator. |
8 | It is an input stream buffer iterator. |
7 | It is an output stream buffer iterator. |
Category tags
Sr.No. | Category tags & Description |
---|---|
1 | Input iterator category. |
2 | output iterator category. |
3 | Forward iterator category. |
4 | Bidirectional iterator category. |
5 | Random-access iterator category. |