Predefined Concepts - Part II
Get an overview of important predefined concepts of C++20.
We'll cover the following...
A vector supports a random_access_iterator. A random_access_iterator is also a bidirectional_iterator. Hence a std::vector also supports a bidirectional_iterator.
General utilities library
Note: The “General utilities library” chapter in the standard has only special memory concepts; therefore, I don’t refer to them here.
Iterators library
The iterators library has many important concepts. They are defined in the <iterator> header. Here are the iterator categories:
input_iteratoroutput_iteratorforward_iteratorbidirectional_iteratorrandom_access_iteratorcontiguous_iterator
The six categories of iterators correspond to the respective iterator concepts. The table below provides two interesting pieces of information. For the three most prominent iterator categories, the table shows their properties and the associated standard library containers.
| Iterator Category | Properties | Containers |
|---|---|---|
std::forward_iterator |
++It, It++ ,*It It == It2, It != It2 |
std::unordered_set |