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 master branch, built from commit c89e626766.
PrevUpHomeNext

prior

Description

Moves an iterator 1 position backwards.

Synopsis
template<
    typename I
    >
typename result_of::prior<I>::type prior(I const& i);

Table 1.3. Parameters

Parameter

Requirement

Description

i

Model of Bidirectional Iterator

Operation's argument


Expression Semantics
prior(i);

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

Semantics: Returns an iterator to the element prior to i.

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

vec v(1,2);
assert(deref(next(begin(v))) == 2);
assert(deref(prior(next(begin(v)))) == 1);

PrevUpHomeNext