• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.. |iterator-category| replace:: *iterator-category*
2.. _iterator-category:
3
4.. parsed-literal::
5
6  *iterator-category*\ (C,R,V) :=
7     if (C is convertible to std::input_iterator_tag
8         || C is convertible to std::output_iterator_tag
9     )
10         return C
11
12     else if (C is not convertible to incrementable_traversal_tag)
13         *the program is ill-formed*
14
15     else return a type X satisfying the following two constraints:
16
17        1. X is convertible to X1, and not to any more-derived
18           type, where X1 is defined by:
19
20             if (R is a reference type
21                 && C is convertible to forward_traversal_tag)
22             {
23                 if (C is convertible to random_access_traversal_tag)
24                     X1 = random_access_iterator_tag
25                 else if (C is convertible to bidirectional_traversal_tag)
26                     X1 = bidirectional_iterator_tag
27                 else
28                     X1 = forward_iterator_tag
29             }
30             else
31             {
32                 if (C is convertible to single_pass_traversal_tag
33                     && R is convertible to V)
34                     X1 = input_iterator_tag
35                 else
36                     X1 = C
37             }
38
39        2. |category-to-traversal|_\ (X) is convertible to the most
40           derived traversal tag type to which X is also
41           convertible, and not to any more-derived traversal tag
42           type.
43
44.. |category-to-traversal| replace:: *category-to-traversal*
45.. _`category-to-traversal`: new-iter-concepts.html#category-to-traversal
46
47[Note: the intention is to allow ``iterator_category`` to be one of
48the five original category tags when convertibility to one of the
49traversal tags would add no information]
50
51.. Copyright David Abrahams 2004. Use, modification and distribution is
52.. subject to the Boost Software License, Version 1.0. (See accompanying
53.. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
54