Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

deref

Description

Returns the type that will be returned by dereferencing an iterator.

Synposis
template<
    typename I
    >
struct deref
{
    typedef unspecified type;
};

Table 1.12. Parameters

Parameter

Requirement

Description

I

Model of Forward Iterator

Operation's argument

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

Return type: Any type

Semantics: Returns the result of dereferencing an iterator of type I.

/iterator/deref.hpp>

Example
typedef vector<int,int&> vec;
typedef const vec const_vec;
typedef result_of::begin<vec>::type first;
typedef result_of::next<first>::type second;

typedef result_of::begin<const_vec>::type const_first;
typedef result_of::next<const_first>::type const_second;

BOOST_MPL_ASSERT((boost::is_same<result_of::deref<first>::type, int&>));
BOOST_MPL_ASSERT((boost::is_same<result_of::deref<second>::type, int&>));

PrevUpHomeNext