| Home | Libraries | People | FAQ | More

### Iterator Facade

##### Description

The `iterator_facade` template provides an intrusive mechanism for producing a conforming Fusion iterator.

##### Synopsis

    template<typename Derived, typename TravesalTag>
    struct iterator_facade;

##### Usage

The user of iterator_facade derives his iterator type from a specialization of iterator_facade and passes the derived iterator type as the first template parameter. The second template parameter should be the traversal category of the iterator being implemented.

The user must the implement the key expressions required by their iterator type.

Table 1.104. Parameters

Name | Description
--- | ---
`iterator`, `It`, `It1`, `It2` | A type derived from `iterator_facade`
`N` | An MPL Integral Constant

Table 1.105. Key Expressions

Expression | Result | Default
--- | --- | ---
`iterator::template value_of<It>::type` | The element stored at iterator position `It` | None
`iterator::template deref<It>::type` | The type returned when dereferencing an iterator of type `It` | None
`iterator::template deref<It>::call(it)` | Dereferences iterator `it` | None
`iterator::template next<It>::type` | The type of the next element from `It` | None
`iterator::template next<It>::call(it)` | The next iterator after `it` | None
`iterator::template prior<It>::type` | The type of the next element from `It` | None
`iterator::template prior<It>::call(it)` | The next iterator after `it` | None
`iterator::template advance<It, N>::type` | The type of an iterator advanced `N` elements from `It` | Implemented in terms of `next` and `prior`
`iterator::template advance<It, N>::call(it)` | An iterator advanced `N` elements from `it` | Implemented in terms of `next` and `prior`
`iterator::template distance<It1, It2>::type` | The distance between iterators of type `It1` and `It2` as an MPL Integral Constant | None
`iterator::template distance<It1, It2>::call(it1, it2)` | The distance between iterator `it1` and `it2` | None
`iterator::template equal_to<It1, It2>::type` | Returns `mpl::true_` if `It1` is equal to `It2`, `mpl::false_` otherwise. | `boost::same_type<It1, It2>::type`
`iterator::template equal_to<It1, It2>::call(it1, it2)` | Returns a type convertible to `bool` that evaluates to `true` if `It1` is equal to `It2`, `false` otherwise. | `boost::same_type<It1, It2>::type()`
`iterator::template key_of<It>::type` | The key type associated with the element from `It` | None
`iterator::template value_of_data<It>::type` | The type of the data property associated with the element from `It` | None
`iterator::template deref_data<It>::type` | The type that will be returned by dereferencing the data property of the element from `It` | None
`iterator::template deref_data<It>::call(it)` | Deferences the data property associated with the element referenced by `it` | None

##### Header

    #include <boost/fusion/iterator/iterator_facade.hpp>
    #include <boost/fusion/include/iterator_facade.hpp>

##### Example

A full working example using `iterator_facade` is provided in triple.cpp in the extension examples.