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

prior

Description

Returns the type of the previous iterator in a sequence.

Synopsis
template<
    typename I
    >
struct prior
{
    typedef unspecified type;
};

Table 1.14. Parameters

Parameter

Requirement

Description

I

Model of Bidirectional Iterator

Operation's argument

Expression Semantics
result_of::prior<I>::type

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

Semantics: Returns an iterator to the previous element in the sequence before I.

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

BOOST_MPL_ASSERT((boost::is_same<result_of::value_of<second>::type, double>));

typedef result_of::prior<second>::type first;
BOOST_MPL_ASSERT((boost::is_same<result_of::value_of<first>::type, int>));

PrevUpHomeNext