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

value_of

Description

Returns the type stored at the position of an iterator.

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

Table 1.11. Parameters

Parameter

Requirement

Description

I

Model of Forward Iterator

Operation's argument


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

Return type: Any type

Semantics: Returns the type stored in a sequence at iterator position I.

Header
#include <boost/fusion/iterator/value_of.hpp>
#include <boost/fusion/include/value_of.hpp>
Example
typedef vector<int,int&,const int&> 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((boost::is_same<result_of::value_of<first>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<result_of::value_of<second>::type, int&>));
BOOST_MPL_ASSERT((boost::is_same<result_of::value_of<third>::type, const int&>));

PrevUpHomeNext