# ConceptRandomAccessIteratorConceptAn iterator allowing random access.

Extends BidirectionalIteratorConcept, LessThanComparableConcept BidirectionalIteratorConcept, CopyConstructibleConcept, DefaultConstructibleConcept, EqualityComparableConcept, ForwardIteratorConcept, InputIteratorConcept, IteratorAssociatedTypesConcept, LessThanComparableConcept MutableRandomAccessIteratorConcept, MutableRootedRandomAccessIteratorConcept, RootedRandomAccessIteratorConcept ```RandomAccessIteratorConcept ```

## Detailed Description

This function is equivalent to --iterator.

### Examples

In the following, x is an iterator to type X, t is a valid rvalue of type X, n is a distance type.

The following expressions must be valid.

```x += n    // Iterator addition assignment.
x + n     // Iterator addition.
n + i     // Iterator addition.
x -= n    // Iterator subtraction assignment.
x - n     // Iterator subtraction.
x - a     // Difference.
x[n]      // Element operator.
```

## Member Function Overview

• `TReference TIterator::operator[](pos);`
C++ built-in array subscript operator.

### Member Functions Inherited From EqualityComparableConcept

• `operator!=`
• `operator==`

### Member Functions Inherited From LessThanComparableConcept

• `operator<`

## Interface Function Overview

• `bool atNil(it);`
Tests whether iterator is at nil position.
• `TDifference difference(begin, end);`
The difference between two iterators.
• `void goFurther(iterator, steps);`
Iterates some steps further.
• `void goNil(it);`
Moves iterator to nil position.
• `TIterator operator+(lhs, rhs);`
• `TIterator operator+=(it, diff);`
• `TIterator operator-=(it, diff);`
C++ built-in subtraction assignment operator.

### Interface Functions Inherited From BidirectionalIteratorConcept

• `goPrevious`
• `operator--(prefix)`
• `operator--(suffix)`

### Interface Functions Inherited From InputIteratorConcept

• `goNext`
• `operator++(prefix)`
• `operator++(suffix)`
• `operator->`

### Interface Functions Inherited From IteratorAssociatedTypesConcept

• `getValue`
• `operator*`
• `value`

## Interface Metafunction Overview

• `Difference<T>::Type`
Type of an object that stores the difference between two iterators.

### Interface Metafunctions Inherited From IteratorAssociatedTypesConcept

• `Difference`
• `GetValue`
• `Pointer`
• `Reference`
• `Value`

## Member Functions Detail

### `TReference TIterator::operator[](pos);`

C++ built-in array subscript operator.

#### Template Parameters

`TReference` The referenced element.

#### Parameters

 `pos` Position to get element at.

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

## Interface Functions Detail

### `bool atNil(it);`

Tests whether iterator is at nil position.

#### Parameters

 `it` The iterator to query.

#### Returns

`bool` Whether or not the iterator is at the nil positions (NULL for pointers).

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

### `TDifference difference(begin, end);`

The difference between two iterators.

#### Parameters

 `begin` Iterator to the first position of a range. Iterator behind the last position of a range.

#### Returns

`TDifference` Length of the range between begin and end, type from

This function is equivalent to end - begin.

Usually, begin and end have the same type.

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

### `void goFurther(iterator, steps);`

Iterates some steps further.

#### Parameters

 `it` The iterator to move. Number of steps iterator should be moved further.

This function is equivalent to iterator += steps.

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

### `void goNil(it);`

Moves iterator to nil position.

#### Parameters

 `it` The iterator that will be moved.

it is set to an invalid position, e.g. NULL for pointer types.

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

### `TIterator operator+(lhs, rhs);`

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

### `TIterator operator+=(it, diff);`

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

### `TIterator operator-=(it, diff);`

C++ built-in subtraction assignment operator.

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

## Interface Metafunctions Detail

### `Difference<T>::Type`

Type of an object that stores the difference between two iterators.

#### Template Parameters

`T` Type for which the difference type is determined.

#### Returns

`Type` The difference type.

In most cases this type is ptrdiff_t.