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

Click here to view the latest version of this page.
PrevUpHomeNext

prior

Description

Moves an iterator 1 position backwards.

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

Table1.4.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