amed req/DefaultConstructible") requirements, using a [ value-initialized ](/w/cpp/language/value_initialization "cpp/language/value initialization") iterator as the source of a copy  or move  (since C++11)  operation. 

In these cases the singular value is overwritten the same way as any other
value. Dereferenceable values are always non-singular.

An _invalid_ iterator is an iterator that may be singular.

####  [ [ edit ](/mwiki/index.php?title=cpp/iterator&action=edit&section=5
"Edit section: Ranges") ]  Ranges

Most of the standard library’s algorithmic templates that operate on data
structures have interfaces that use ranges.

An iterator  j  is called _reachable_ from an iterator  i  if and only if there is a finite sequence of applications of the expression  ++  i  that makes  i  ==  j  . If  j  is reachable from  i  , they refer to elements of the same sequence.  A _range_ is a pair of iterators that designate the beginning and end of the computation. A range ` [ ` i  ` , ` i  ` ) ` is an empty range; in general, a range ` [ ` i  ` , ` j  ` ) ` refers to the elements in the data structure starting with the element pointed to by  i  and up to but not including the element pointed to by  j  .  Range ` [ ` i  ` , ` j  ` ) ` is _valid_ if and only if  j  is reachable from  i  .  |  (until C++20)   
---|---  
A _range_ can be denoted by either

  * ` [ ` i  ` , ` s  ` ) ` , with an iterator  i  and a _sentinel_ s  that designate the beginning and end of the computation (  i  and  s  can have different types), or 
  * i  ` + ` ` [ ` ​  0  ​  ` , ` n  ` ) ` , with an iterator  i  and a count  n  that designate the beginning and the number of elements to which the computation is to be applied. 

#####  Iterator-sentinel range

An iterator and a sentinel denoting a range are comparable. ` [ ` i  ` , ` s
` ) ` is empty if  i  ==  s  ; otherwise, ` [ ` i  ` , ` s  ` ) ` refers to
the elements in the data structure starting with the element pointed to by  i
and up to but not including the element, if any, pointed to by the first
iterator  j  such that  j  ==  s  .  A sentinel  s  is called _reachable_ from
an iterator  i  if and only if there is a finite sequence of applications of
the expression  ++  i  that makes  i  ==  s  .  If  s  is reachable from  i  ,
` [ ` i  ` , ` s  ` ) ` denotes a _valid_ range.

#####  Counted range

A _counted range_ i  ` + ` ` [ ` ​  0  ​  ` , ` n  ` ) ` is empty if  n  ==  0
; otherwise,  i  ` + ` ` [ ` ​  0  ​  ` , ` n  ` ) ` refers to the  n
elements in the data structure starting with the element pointed to by  i  and
up to but not including the element, if any, pointed to by the result of  n
applications of  ++  i  .  A counted range  i  ` + ` ` [ ` ​  0  ​  ` , ` n  `
) ` is _valid_ if and only if

  * n  ==  0  ; or 
  * all of the following conditions are satisfied: 
    * n  is positive, 
    * i  is dereferenceable, and 
    * ++  i  ` + ` ` [ ` ​  0  ​  ` , ` \--  n  ` ) ` is valid. 

|  (since C++20)  
  
The result of the application of functions in the standard library to invalid
ranges is undefined.

###  [ [ edit ](/mwiki/index.php?title=cpp/iterator&action=edit&section=8
"Edit section: Iterator concepts \(since C++20\)") ]  Iterator concepts
(since C++20)

A new system of iterators based on [ concepts ](/w/cpp/language/constraints
"cpp/language/constraints") that are different from C++17 iterators. While the
basic taxonomy remains similar, the requirements for individual iterator
categories are somewhat different.

Defined in namespace ` std `  
---  
[ indirectly_readable  ](/w/cpp/iterator/indirectly_readable "cpp/iterator/indirectly readable") (C++20)  |  specifies that a type is indirectly readable by applying operator ` * `   
(concept)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/iterator/dsc_indirectly_readable&action=edit)  
[ indirectly_writable  ](/w/cpp/iterator/indirectly_writable "cpp/iterator/indirectly writable") (C++20)  |  specifies th