cppreference states:
The ranges library is an extension and generalization of the algorithms and iterator libraries that makes them more powerful by making them composable and less error-prone.
The library creates and manipulates range views, lightweight objects that indirectly represent iterable sequences (ranges).
It mentions using range views, which are, as cppreference states:
The range concept defines the requirements of a type that allows iteration over its elements by providing an iterator and sentinel that denote the elements of the range.
But from an outside perspective, it just seems like a wrapper of an iterator with a concept
. So the main question is:
- What are the problems with using regular iterators that the ranges library solves (code examples will be appreciated), and when should you use it?