Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for a snapshot of the develop branch, built from commit 0f79ae966a.
PrevUpHomeNext

advance

Description

Moves an iterator by a specified distance.

Synopsis
template<
    typename M,
    typename I
    >
typename result_of::advance<I, M>::type advance(I const& i);

Table 1.5. Parameters

Parameter

Requirement

Description

i

Model of Forward Iterator

Iterator to move relative to

M

An MPL Integral Constant

Number of positions to move


Expression Semantics
advance<M>(i);

Return type: A model of the same iterator concept as i.

Semantics: Returns an iterator to the element M positions from i. If i is a Bidirectional Iterator then M may be negative.

Header
#include <boost/fusion/iterator/advance.hpp>
#include <boost/fusion/include/advance.hpp>
Example
typedef vector<int,int,int> vec;

vec v(1,2,3);
assert(deref(advance<mpl::int_<2> >(begin(v))) == 3);

PrevUpHomeNext