InputIterator.xml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <?xml version="1.0"?>
  2. <concept name="InputIterator" 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>An input iterator is an iterator that can read through a sequence of
  20. values. It is single-pass (old values of the iterator cannot be
  21. re-used), and read-only.</para>
  22. <para>An input iterator represents a position in a sequence. Therefore, the
  23. iterator can point into the sequence (returning a value when dereferenced
  24. and being incrementable), or be off-the-end (and not dereferenceable or
  25. incrementable).</para>
  26. </description>
  27. <refines const="no" concept="Assignable"/>
  28. <refines const="no" concept="DefaultConstructible"/>
  29. <refines const="no" concept="EqualityComparable"/>
  30. <notation variables="i j">
  31. <sample-value>
  32. <type name="Iter"/>
  33. </sample-value>
  34. </notation>
  35. <associated-type name="value_type">
  36. <get-member-type name="value_type">
  37. <apply-template name="std::iterator_traits">
  38. <type name="Iter"/>
  39. </apply-template>
  40. </get-member-type>
  41. <description><simpara>The value type of the iterator (not necessarily what
  42. <code>*i</code> returns)</simpara></description>
  43. </associated-type>
  44. <associated-type name="difference_type">
  45. <get-member-type name="difference_type">
  46. <apply-template name="std::iterator_traits">
  47. <type name="Iter"/>
  48. </apply-template>
  49. </get-member-type>
  50. <description><simpara>The difference type of the iterator</simpara></description>
  51. </associated-type>
  52. <associated-type name="category">
  53. <get-member-type name="iterator_category">
  54. <apply-template name="std::iterator_traits">
  55. <type name="Iter"/>
  56. </apply-template>
  57. </get-member-type>
  58. <description><simpara>The category of the iterator</simpara></description>
  59. </associated-type>
  60. <notation variables="x">
  61. <sample-value>
  62. <type name="value_type"/>
  63. </sample-value>
  64. </notation>
  65. <valid-type-expression name="Category tag">
  66. <description/>
  67. <type name="category"/>
  68. <return-type>
  69. <derived-from testable="yes">
  70. <type name="std::input_iterator_tag"/>
  71. </derived-from>
  72. <models-as-first-arg const="no" testable="yes" concept="DefaultConstructible"/>
  73. <models-as-first-arg const="no" testable="yes" concept="CopyConstructible"/>
  74. </return-type>
  75. </valid-type-expression>
  76. <valid-type-expression name="Value type copy constructibility">
  77. <description/>
  78. <type name="value_type"/>
  79. <return-type>
  80. <models-as-first-arg const="no" testable="yes" concept="CopyConstructible"/>
  81. </return-type>
  82. </valid-type-expression>
  83. <valid-type-expression name="Difference type properties">
  84. <description/>
  85. <type name="difference_type"/>
  86. <return-type>
  87. <models-as-first-arg const="no" testable="yes" concept="SignedInteger"/>
  88. </return-type>
  89. </valid-type-expression>
  90. <valid-expression name="Dereference">
  91. <dereference>
  92. <sample-value><type name="Iter"/></sample-value>
  93. </dereference>
  94. <return-type>
  95. <convertible-to testable="yes"><type name="value_type"/></convertible-to>
  96. </return-type>
  97. <precondition><code>i</code> is incrementable (not
  98. off-the-end)</precondition>
  99. </valid-expression>
  100. <valid-expression name="Preincrement">
  101. <preincrement>
  102. <sample-value><reference-to><type name="Iter"/></reference-to></sample-value>
  103. </preincrement>
  104. <return-type>
  105. <require-same-type testable="yes">
  106. <reference-to><type name="Iter"/></reference-to>
  107. </require-same-type>
  108. </return-type>
  109. <precondition><code>i</code> is incrementable (not
  110. off-the-end)</precondition>
  111. </valid-expression>
  112. <valid-expression name="Postincrement">
  113. <postincrement>
  114. <sample-value><reference-to><type name="Iter"/></reference-to></sample-value>
  115. </postincrement>
  116. <return-type/>
  117. <precondition><code>i</code> is incrementable (not
  118. off-the-end)</precondition>
  119. <semantics>Equivalent to <code>(void)(++i)</code></semantics>
  120. <postcondition><code>i</code> is dereferenceable or
  121. off-the-end</postcondition>
  122. </valid-expression>
  123. <valid-expression name="Postincrement and dereference">
  124. <dereference>
  125. <postincrement>
  126. <sample-value><reference-to><type name="Iter"/></reference-to></sample-value>
  127. </postincrement>
  128. </dereference>
  129. <return-type>
  130. <convertible-to testable="yes"><type name="value_type"/></convertible-to>
  131. </return-type>
  132. <precondition><code>i</code> is incrementable (not
  133. off-the-end)</precondition>
  134. <semantics>Equivalent to <code>{value_type t = *i; ++i; return t;}</code></semantics>
  135. <postcondition><code>i</code> is dereferenceable or
  136. off-the-end</postcondition>
  137. </valid-expression>
  138. <complexity>
  139. All iterator operations must take amortized constant time.
  140. </complexity>
  141. <example-model>
  142. <type name="std::istream_iterator"/>
  143. </example-model>
  144. <see-also concept="OutputIterator"/>
  145. <see-also concept="ForwardIterator"/>
  146. </concept>