Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Forward Iterator

Description

A Forward Iterator traverses a Sequence allowing movement in only one direction through it's elements, one element at a time.

Notation

i, j
Forward Iterators
I, J
Forward Iterator types
M
An MPL integral constant
N
An integral constant
Expression requirements

A type models Forward Iterator if, in addition to being CopyConstructable, the following expressions are valid:

Expression Return type Runtime Complexity
next(i) Forward Iterator Constant
i == j Convertible to bool Constant
i != j Convertible to bool Constant
advance_c<N>(i) Forward Iterator Constant
advance<M>(i) Forward Iterator Constant
distance(i, j) result_of::distance<I, J>::type Constant
deref(i) result_of::deref<I>::type Constant
*i result_of::deref<I>::type Constant
Meta Expressions

Expression Compile Time Complexity
result_of::next<I>::type Amortized constant time
result_of::equal_to<I, J>::type Amortized constant time
result_of::advance_c<I, N>::type Linear
result_of::advance<I ,M>::type Linear
result_of::distance<I ,J>::type Linear
result_of::deref<I>::type Amortized constant time
result_of::value_of<I>::type Amortized constant time
Expression Semantics

Expression Semantics
next(i) An iterator to the element following i
i == j Iterator equality comparison
i != j Iterator inequality comparison
advance_c<N>(i) An iterator n elements after i in the sequence
advance<M>(i) Equivalent to advance_c<M::value>(i)
distance(i, j) The number of elements between i and j
deref(i) The element at positioni
*i Equivalent to deref(i)
Invariants

The following invariants always hold:

Models
Copyright © 2001-2005 Joel de Guzman, Dan Marsden

PrevUpHomeNext