Concept RandomAccessIteratorConcept
An iterator allowing random access.

Extends BidirectionalIteratorConcept, LessThanComparableConcept
All Extended BidirectionalIteratorConcept, CopyConstructibleConcept, DefaultConstructibleConcept, EqualityComparableConcept, ForwardIteratorConcept, InputIteratorConcept, IteratorAssociatedTypesConcept, LessThanComparableConcept
All Subcl's MutableRandomAccessIteratorConcept, MutableRootedRandomAccessIteratorConcept, RootedRandomAccessIteratorConcept
Defined in <seqan/basic.h>
Signature RandomAccessIteratorConcept<T>

Detailed Description

This function is equivalent to --iterator.


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

Member Functions Inherited From EqualityComparableConcept

Member Functions Inherited From LessThanComparableConcept

Interface Function Overview

Interface Functions Inherited From BidirectionalIteratorConcept

Interface Functions Inherited From InputIteratorConcept

Interface Functions Inherited From IteratorAssociatedTypesConcept

Interface Metafunction Overview

Interface Metafunctions Inherited From IteratorAssociatedTypesConcept

Member Functions Detail

TReference TIterator::operator[](pos);

C++ built-in array subscript operator.

Template Parameters

TReference The referenced element.


pos Position to get element at.

Interface Functions Detail

bool atNil(it);

Tests whether iterator is at nil position.


it The iterator to query.


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

TDifference difference(begin, end);

The difference between two iterators.


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


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.

void goFurther(iterator, steps);

Iterates some steps further.


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

This function is equivalent to iterator += steps.

void goNil(it);

Moves iterator to nil position.


it The iterator that will be moved.

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

TIterator operator+(lhs, rhs);

C++ built-in addition operator.

TIterator operator+=(it, diff);

C++ built-in addition assignment operator.

TIterator operator-=(it, diff);

C++ built-in subtraction assignment operator.

Interface Metafunctions Detail


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

Template Parameters

T Type for which the difference type is determined.


Type The difference type.

In most cases this type is ptrdiff_t.