1 .. Iterators/Iterator Metafunctions//iterator_category |60
14 struct iterator_category
16 typedef typename Iterator::category type;
24 Returns one of the following iterator category tags:
26 * ``forward_iterator_tag``
27 * ``bidirectional_iterator_tag``
28 * ``random_access_iterator_tag``
36 #include <boost/mpl/iterator_category.hpp>
37 #include <boost/mpl/iterator_tags.hpp>
43 +---------------+-----------------------+-------------------------------------------+
44 | Parameter | Requirement | Description |
45 +===============+=======================+===========================================+
46 | ``Iterator`` | |Forward Iterator| | The iterator to obtain a category for. |
47 +---------------+-----------------------+-------------------------------------------+
53 For any |Forward Iterator|\ s ``iter``:
58 typedef iterator_category<iter>::type tag;
64 ``tag`` is ``forward_iterator_tag`` if ``iter`` is a model of |Forward Iterator|,
65 ``bidirectional_iterator_tag`` if ``iter`` is a model of |Bidirectional Iterator|,
66 or ``random_access_iterator_tag`` if ``iter`` is a model of |Random Access Iterator|;
69 ``forward_iterator_tag::value < bidirectional_iterator_tag::value``,
70 ``bidirectional_iterator_tag::value < random_access_iterator_tag::value``.
76 Amortized constant time.
84 template< typename Tag, typename Iterator >
87 // *O(n)* implementation
90 template< typename Iterator >
91 struct algorithm_impl<random_access_iterator_tag,Iterator>
93 // *O(1)* implementation
96 template< typename Iterator >
99 iterator_category<Iterator>::type
110 |Iterators|, |begin| / |end|, |advance|, |distance|, |next|
113 .. copyright:: Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams
114 Distributed under the Boost Software License, Version 1.0. (See accompanying
115 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)