ForwardIterator.xml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <?xml version="1.0"?>
  2. <concept name="ForwardIterator" category="Iterator"><!--
  3. Based on concepts from the SGI Standard Template Library documentation:
  4. Copyright (c) 1996-1999
  5. Silicon Graphics Computer Systems, Inc.
  6. Copyright (c) 1994
  7. Hewlett-Packard Company
  8. --><!--
  9. Copyright 2000-2001 University of Notre Dame du Lac.
  10. Copyright 2001-2002 Indiana University.
  11. Some concepts based on versions from the MTL draft manual and Boost Graph
  12. and Property Map documentation:
  13. Copyright (c) Jeremy Siek, Lie-Quan Lee, and Andrew Lumsdaine 2000
  14. -->
  15. <param name="Iter" role="iterator-type"/>
  16. <use-header name="iterator"/>
  17. <models-sentence>The iterator type <arg num="1"/> must be a model of <self/>.</models-sentence>
  18. <description>
  19. <para>A forward iterator is an iterator that can read through a sequence of
  20. values. It is multi-pass (old values of the iterator can be
  21. re-used), and can be either mutable (data pointed to by it can be
  22. changed) or not mutable.</para>
  23. <para>An iterator represents a position in a sequence. Therefore, the
  24. iterator can point into the sequence (returning a value when dereferenced
  25. and being incrementable), or be off-the-end (and not dereferenceable or
  26. incrementable).</para>
  27. </description>
  28. <associated-type name="value_type">
  29. <get-member-type name="value_type">
  30. <apply-template name="std::iterator_traits">
  31. <type name="Iter"/>
  32. </apply-template>
  33. </get-member-type>
  34. <description><simpara>The value type of the iterator</simpara></description>
  35. </associated-type>
  36. <refines const="no" concept="InputIterator"/>
  37. <refines const="no" concept="OutputIterator"/>
  38. <!-- DPG doesn't understand this
  39. <models const="no" testable="yes" concept="Input Iterator">
  40. <type name="Iter"/>
  41. </models>
  42. -->
  43. <!--
  44. <models-when-mutable concept="Output Iterator">
  45. <type name="Iter"/>
  46. <type name="value_type"/>
  47. </models-when-mutable>
  48. -->
  49. <notation variables="i j">
  50. <sample-value>
  51. <type name="Iter"/>
  52. </sample-value>
  53. </notation>
  54. <associated-type name="category">
  55. <get-member-type name="iterator_category">
  56. <apply-template name="std::iterator_traits">
  57. <type name="Iter"/>
  58. </apply-template>
  59. </get-member-type>
  60. <description><simpara>The category of the iterator</simpara></description>
  61. </associated-type>
  62. <notation variables="x">
  63. <sample-value>
  64. <type name="value_type"/>
  65. </sample-value>
  66. </notation>
  67. <valid-type-expression name="Category tag">
  68. <description/>
  69. <type name="category"/>
  70. <return-type>
  71. <derived-from testable="yes">
  72. <type name="std::forward_iterator_tag"/>
  73. </derived-from>
  74. </return-type>
  75. </valid-type-expression>
  76. <valid-expression name="Dereference">
  77. <dereference>
  78. <sample-value><type name="Iter"/></sample-value>
  79. </dereference>
  80. <return-type>
  81. <require-same-type testable="yes">
  82. <const-if-not-mutable>
  83. <reference-to><type name="value_type"/></reference-to>
  84. </const-if-not-mutable>
  85. </require-same-type>
  86. </return-type>
  87. <precondition><code>i</code> is incrementable (not
  88. off-the-end)</precondition>
  89. </valid-expression>
  90. <valid-expression name="Member access">
  91. <pointer-member>
  92. <sample-value><type name="Iter"/></sample-value>
  93. </pointer-member>
  94. <return-type>
  95. <require-same-type testable="yes">
  96. <const-if-not-mutable>
  97. <pointer-to><type name="value_type"/></pointer-to>
  98. </const-if-not-mutable>
  99. </require-same-type>
  100. </return-type>
  101. <precondition><code>i</code> is incrementable (not
  102. off-the-end)</precondition>
  103. </valid-expression>
  104. <valid-expression name="Preincrement">
  105. <preincrement>
  106. <sample-value><reference-to><type name="Iter"/></reference-to></sample-value>
  107. </preincrement>
  108. <return-type>
  109. <require-same-type testable="yes">
  110. <reference-to><type name="Iter"/></reference-to>
  111. </require-same-type>
  112. </return-type>
  113. <precondition><code>i</code> is incrementable (not
  114. off-the-end)</precondition>
  115. </valid-expression>
  116. <valid-expression name="Postincrement">
  117. <postincrement>
  118. <sample-value><reference-to><type name="Iter"/></reference-to></sample-value>
  119. </postincrement>
  120. <return-type>
  121. <require-same-type testable="yes"><type name="Iter"/></require-same-type>
  122. </return-type>
  123. <precondition><code>i</code> is incrementable (not
  124. off-the-end)</precondition>
  125. <semantics>Equivalent to <code>{Iter j = i; ++i; return j;}</code></semantics>
  126. <postcondition><code>i</code> is dereferenceable or
  127. off-the-end</postcondition>
  128. </valid-expression>
  129. <complexity>
  130. All iterator operations must take amortized constant time.
  131. </complexity>
  132. <invariant name="Predecrement must return object">
  133. <code>&amp;i = &amp;(++i)</code>
  134. </invariant>
  135. <invariant name="Unique path through sequence">
  136. <code>i == j</code> implies <code>++i == ++j</code>
  137. </invariant>
  138. <example-model>
  139. <pointer-to>
  140. <type name="T"/>
  141. </pointer-to>
  142. </example-model>
  143. <example-model>
  144. <get-member-type name="iterator">
  145. <apply-template name="std::hash_set">
  146. <type name="T"/>
  147. </apply-template>
  148. </get-member-type>
  149. </example-model>
  150. <see-also concept="BidirectionalIterator"/>
  151. </concept>