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 / Sequences / Views / iterator_range

iterator_range

Synopsis

template<
      typename First
    , typename Last
    >
struct iterator_range
{
    // unspecified
    // ...
};

Description

A view into subset of sequence elements identified by a pair of iterators.

Header

#include <boost/mpl/fold.hpp>

Model of

Parameters

Parameter Requirement Description
First, Last Forward Iterator Iterators identifying the view's boundaries.

Expression semantics

The semantics of an expression are defined only where they differ from, or are not defined in Forward Sequence.

In the following table, v is an instance of iterator_range, first and last are iterators into a Forward Sequence, and [first, last) form a valid range.

Expression Semantics
iterator_range<first,last>
iterator_range<first,last>::type
A lazy sequence all the elements in the range [first, last).

Example

typedef range_c<int,0,100> r;
typedef advance_c< begin<r>::type,10 >::type first;
typedef advance_c< end<r>::type,-10 >::type last;

BOOST_MPL_ASSERT(( equal< 
      iterator_range<first,last>
    , range_c<int,10,90>
    > ));

See also

Sequences, Views, filter_view, transform_view, joint_view, zip_view, max_element