blob: 90bc9e1e2c25fc365284628959beb0e0e82402b6 [file] [log] [blame]
[section:traits Iterator Traits]
`std::iterator_traits` provides access to five associated types
of any iterator: its `value_type`, `reference`, `pointer`,
`iterator_category`, and `difference_type`. Unfortunately,
such a "multi-valued" traits template can be difficult to use in a
metaprogramming context. `<boost/iterator/iterator_traits.hpp>`
provides access to these types using a standard metafunctions_.
[h2 Synopsis]
Header `<boost/iterator/iterator_traits.hpp>`:
template <class Iterator>
struct iterator_value
{
typedef typename
std::iterator_traits<Iterator>::value_type
type;
};
template <class Iterator>
struct iterator_reference
{
typedef typename
std::iterator_traits<Iterator>::reference
type;
};
template <class Iterator>
struct iterator_pointer
{
typedef typename
std::iterator_traits<Iterator>::pointer
type;
};
template <class Iterator>
struct iterator_difference
{
typedef typename
detail::iterator_traits<Iterator>::difference_type
type;
};
template <class Iterator>
struct iterator_category
{
typedef typename
detail::iterator_traits<Iterator>::iterator_category
type;
};
[endsect]