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.
Front Page / Iterators / Iterator Metafunctions / deref

deref

Synopsis

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

Description

Dereferences an iterator.

Header

#include <boost/mpl/deref.hpp>

Parameters

Parameter Requirement Description
Iterator Forward Iterator The iterator to dereference.

Expression semantics

For any Forward Iterators iter:

typedef deref<iter>::type t; 
Return type:A type.
Precondition:iter is dereferenceable.
Semantics:

t is identical to the element referenced by iter. If iter is a user-defined iterator, the library-provided default implementation is equivalent to

typedef iter::type t;

Complexity

Amortized constant time.

Example

typedef vector<char,short,int,long> types;
typedef begin<types>::type iter;

BOOST_MPL_ASSERT(( is_same< deref<iter>::type, char > ));

See also

Iterators, begin / end, next