C++ concepts: RandomAccessIterator
From cppreference.com
                    
                                        
                    
                    
                                                            
                    A RandomAccessIterator is a BidirectionalIterator that can be moved to point to any element in constant time.
A standard pointer is an example of a type that satisfies this concept.
[edit] Requirements
In addition to the above requirement, for a type It to be an RandomAccessIterator, instances a, b, i, and r of It must:
| Expression | Return | Equivalent expression | Notes | 
|---|---|---|---|
| r += n | It& | 
if ( n >= 0 )    while(n--) ++r;  | 
  | 
| i + n | It | 
It temp = i; return temp += n;  | 
|
| n + i | It | i + n | |
| r -= n | It& | return r += -n; | |
| i - n | It | 
It temp = i; return temp -= n;  | 
|
| b - a | difference | n | returns n such that a + n == b, where b == a + (b - a).
 | 
| i[n] | convertible to reference | *(i + n) | |
| a < b | contextually convertible to bool | b - a > 0 | Strict total ordering relation:
  | 
| a > b | contextually convertible to bool | b < a | Total ordering relation opposite to a < b | 
| a >= b | contextually convertible to bool | !(a < b) | |
| a <= b | contextually convertible to bool | !(a > b) | 
[edit] Table Notes
- 
Itis the type implementing this concept - 
Tis the type std::iterator_traits<It>::value_type - 
referenceis the type std::iterator_traits<It>::reference - 
differenceis the type std::iterator_traits<It>::difference_type - 
i,a,bare objects of typeItorconst It - 
ris a value of typeIt& - 
nis an integer of typedifference 
The above rules imply that RandomAccessIterator also implements LessThanComparable.
A mutable RandomAccessIterator is a RandomAccessIterator that additionally satisfies the OutputIterator requirements.