...

/

Understanding Range Concepts and Views

Understanding Range Concepts and Views

Explore the range adaptors and constrained algorithms of the ranges library in this lesson.

The term “range” refers to an abstraction that defines a sequence of elements bounded by start and end iterators. A range, therefore, represents an iterable sequence of elements. However, such a sequence can be defined in several ways:

  • With a begin iterator and an end sentinel. Such a sequence is iterated from the beginning to the end. A sentinel is an object that indicates the end of the sequence. It can have the same type as the iterator type, or it can be of a different type.

  • With a start object and a size (number of elements), representing a counted sequence. Such a sequence is iterated NN times (where NN ...