# std::ranges::range

< cpp‎ | ranges
 Defined in header  template< class T > concept range = requires(T& t) {   ranges::begin(t); // equality-preserving for forward iterators   ranges::end  (t); };

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.

### Semantic requirements

Given an expression E such that decltype((E)) is T, T models range only if

• [, ranges::end(E)) denotes a range, and
• both and ranges::end(E) are amortized constant time and do not alter the value of E in a manner observable to equality-preserving expressions, and
• if the type of models forward_iterator, is equality-preserving (in other words, forward iterators support multi-pass algorithms)

Note: In the definition above, the required expressions ranges::begin(std::forward<T>(t)) and ranges::end(std::forward<T>(t)) do not require implicit expression variations.