Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Single Pass Range

Notation

X

A type that is a model of Single Pass Range.

a

Object of type X.

Description

A range X where boost::range_iterator<X>::type is a model of Single Pass Iterator.

Associated types

Iterator type

boost::range_iterator<X>::type

The type of iterator used to iterate through a Range's elements. The iterator's value type is expected to be the Range's value type. A conversion from the iterator type to the const iterator type must exist.

Const iterator type

boost::range_iterator<const X>::type

A type of iterator that may be used to examine, but not to modify, a Range's elements.

Valid expressions

The following expressions must be valid.

Name

Expression

Return type

Beginning of range

boost::begin(a)

boost::range_iterator<X>::type if a is mutable, boost::range_iterator<const X>::type otherwise

End of range

boost::end(a)

boost::range_iterator<X>::type if a is mutable, boost::range_iterator<const X>::type otherwise

Expression semantics

Expression

Semantics

Postcondition

boost::begin(a)

Returns an iterator pointing to the first element in the Range.

boost::begin(a) is either dereferenceable or past-the-end. It is past-the-end if and only if boost::distance(a) == 0.

boost::end(a)

Returns an iterator pointing one past the last element in the Range.

boost::end(a) is past-the-end.

Complexity guarantees

boost::end(a) is at most amortized linear time, boost::begin(a) is amortized constant time. For most practical purposes, one can expect both to be amortized constant time.

Invariants

Valid range

For any Range a, [boost::begin(a),boost::end(a)) is a valid range, that is, boost::end(a) is reachable from boost::begin(a) in a finite number of increments.

Completeness

An algorithm that iterates through the range [boost::begin(a),boost::end(a)) will pass through every element of a.

See also

Extending the library for UDTs

Implementation of metafunctions

Implementation of functions

Container


PrevUpHomeNext