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 for the latest Boost documentation.

[Home]iterator_category

Synopsis

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

Description

Returns one of the following iterator category tags: input_iterator_tag, forward_iterator_tag, bidirectional_iterator_tag, or random_access_iterator_tag.

Definition

#include "boost/mpl/iterator_category.hpp"
#include "boost/mpl/iterator_tag.hpp"

Parameters

 Parameter  Requirement  Description  
IteratorA model of Input Iterator

Expression semantics

 Expression  Expression type  Precondition  Semantics  Postcondition  
typedef iterator_category<Iterator>::type tag;An iterator category tagtag is input_iterator_tag if Iterator is a model of Input Iterator, forward_iterator_tag if Iterator is a model of Forward Iterator, bidirectional_iterator_tag if Iterator is a model of Bidirectional Iterator, or random_access_iterator_tag if Iterator is a model of Random Access Iterator.

Complexity

Amortized constant time.

Example

template< typename Iterator >
struct my_algorithm
    : my_algorithm_impl<
          iterator_category<Iterator>::type
        , Iterator
        >
{
};

See also

Iterators, Sequence, begin, end, advance, distance


Table of Contents
Last edited July 17, 2002 6:20 am