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 an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

advance_c

Description

Moves an iterator by a specified distance.

Synopsis
template<
    typename I,
    int N
    >
struct advance_c
{
    typedef unspecified type;
};

Table 1.18. Parameters

Parameter

Requirement

Description

I

Model of Forward Iterator

Iterator to move relative to

N

Integer constant

Number of positions to move

Expression Semantics
result_of::advance_c<I, N>::type

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

Semantics: Returns an iterator a distance N from I. If I is a Bidirectional Iterator then N may be negative. Equivalent to result_of::advance<I, boost::mpl::int_<N> >::type.

Header
#include <boost/fusion/iterator/advance.hpp>
#include <boost/fusion/include/advance.hpp>
Example
typedef vector<int,double,char> vec;
typedef result_of::begin<vec>::type first;
typedef result_of::next<first>::type second;
typedef result_of::next<second>::type third;

BOOST_MPL_ASSERT((result_of::equal_to<result_of::advance_c<first, 2>::type, third>));

PrevUpHomeNext