facade_iterator_category.rst 2.0 KB

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