# 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
--- | --- | ---
`Iterator` | A model of Input Iterator |

### Expression semantics

Expression | Expression type | Precondition | Semantics | Postcondition
--- | --- | --- | --- | ---
`typedef iterator_category<Iterator>::type tag;` | An iterator category tag |  | `tag` 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