InputIterator.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
  4. <title>Concept InputIterator</title>
  5. <link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
  6. <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
  7. <link rel="home" href="index.html" title="Concept reference">
  8. <link rel="up" href="index.html" title="Concept reference">
  9. <link rel="prev" href="Assignable.html" title="Concept Assignable">
  10. <link rel="next" href="OutputIterator.html" title="Concept OutputIterator">
  11. </head>
  12. <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
  13. <table cellpadding="2" width="100%"><tr>
  14. <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
  15. <td align="center"><a href="../../../../index.html">Home</a></td>
  16. <td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
  17. <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
  18. <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
  19. <td align="center"><a href="../../../../more/index.htm">More</a></td>
  20. </tr></table>
  21. <hr>
  22. <div class="spirit-nav">
  23. <a accesskey="p" href="Assignable.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="index.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="OutputIterator.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
  24. </div>
  25. <div class="refentry">
  26. <a name="InputIterator"></a><div class="titlepage"></div>
  27. <div class="refnamediv">
  28. <h2><span class="refentrytitle">Concept InputIterator</span></h2>
  29. <p>InputIterator</p>
  30. </div>
  31. <div class="refsect1">
  32. <a name="idm45853371055952"></a><h2>Description</h2>
  33. <p>An input iterator is an iterator that can read through a sequence of
  34. values. It is single-pass (old values of the iterator cannot be
  35. re-used), and read-only.</p>
  36. <p>An input iterator represents a position in a sequence. Therefore, the
  37. iterator can point into the sequence (returning a value when dereferenced
  38. and being incrementable), or be off-the-end (and not dereferenceable or
  39. incrementable).</p>
  40. </div>
  41. <div class="refsect1">
  42. <a name="idm45853371054208"></a><h2>Refinement of</h2>
  43. <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
  44. <li class="listitem"><p><a class="link" href="Assignable.html" title="Concept Assignable">Assignable</a></p></li>
  45. <li class="listitem"><p><a class="link" href="DefaultConstructible.html" title="Concept DefaultConstructible">DefaultConstructible</a></p></li>
  46. <li class="listitem"><p><a class="link" href="EqualityComparable.html" title="Concept EqualityComparable">EqualityComparable</a></p></li>
  47. </ul></div>
  48. </div>
  49. <div class="refsect1">
  50. <a name="idm45853371050640"></a><h2>Associated types</h2>
  51. <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
  52. <li class="listitem">
  53. <p><span class="bold"><strong>value_type</strong></span></p>
  54. <pre class="literallayout">std::iterator_traits&lt;Iter&gt;::value_type</pre>
  55. <p>The value type of the iterator (not necessarily what
  56. <code class="computeroutput">*i</code> returns)</p>
  57. </li>
  58. <li class="listitem">
  59. <p><span class="bold"><strong>difference_type</strong></span></p>
  60. <pre class="literallayout">std::iterator_traits&lt;Iter&gt;::difference_type</pre>
  61. <p>The difference type of the iterator</p>
  62. </li>
  63. <li class="listitem">
  64. <p><span class="bold"><strong>category</strong></span></p>
  65. <pre class="literallayout">std::iterator_traits&lt;Iter&gt;::iterator_category</pre>
  66. <p>The category of the iterator</p>
  67. </li>
  68. </ul></div>
  69. </div>
  70. <div class="refsect1">
  71. <a name="idm45853371043104"></a><h2>Notation</h2>
  72. <div class="variablelist"><dl class="variablelist">
  73. <dt><span class="term">Iter</span></dt>
  74. <dd>A type playing the role of iterator-type in the <a class="link" href="InputIterator.html" title="Concept InputIterator">InputIterator</a> concept.</dd>
  75. <dt>
  76. <span class="term"><code class="varname">i</code>, </span><span class="term"><code class="varname">j</code></span>
  77. </dt>
  78. <dd>Objects of type Iter</dd>
  79. <dt><span class="term"><code class="varname">x</code></span></dt>
  80. <dd>Object of type value_type</dd>
  81. </dl></div>
  82. </div>
  83. <div class="refsect1">
  84. <a name="idm45853365540624"></a><h2>Type expressions</h2>
  85. <div class="variablelist"><dl class="variablelist">
  86. <dt><span class="term">Category tag</span></dt>
  87. <dd><p><span class="type">category</span> must be
  88. derived from <span class="type">std::input_iterator_tag</span>, a model of <a class="link" href="DefaultConstructible.html" title="Concept DefaultConstructible">DefaultConstructible</a>, and a model of <a class="link" href="CopyConstructible.html" title="Concept CopyConstructible">CopyConstructible</a>.
  89. </p></dd>
  90. <dt><span class="term">Value type copy constructibility</span></dt>
  91. <dd><p><span class="type">value_type</span> must be
  92. a model of <a class="link" href="CopyConstructible.html" title="Concept CopyConstructible">CopyConstructible</a>.
  93. </p></dd>
  94. <dt><span class="term">Difference type properties</span></dt>
  95. <dd><p><span class="type">difference_type</span> must be
  96. a model of <a class="link" href="SignedInteger.html" title="Concept SignedInteger">SignedInteger</a>.
  97. </p></dd>
  98. </dl></div>
  99. </div>
  100. <div class="refsect1">
  101. <a name="idm45853365534160"></a><h2>Valid expressions</h2>
  102. <div class="informaltable"><table class="table">
  103. <colgroup>
  104. <col>
  105. <col>
  106. <col>
  107. <col>
  108. <col>
  109. <col>
  110. </colgroup>
  111. <thead><tr>
  112. <th>Name</th>
  113. <th>Expression</th>
  114. <th>Type</th>
  115. <th>Precondition</th>
  116. <th>Semantics</th>
  117. <th>Postcondition</th>
  118. </tr></thead>
  119. <tbody>
  120. <tr>
  121. <td><p>Dereference</p></td>
  122. <td><p>*i</p></td>
  123. <td><p>Convertible to <span class="type">value_type</span></p></td>
  124. <td><p><code class="computeroutput">i</code> is incrementable (not
  125. off-the-end)</p></td>
  126. <td>&#160;</td>
  127. <td>&#160;</td>
  128. </tr>
  129. <tr>
  130. <td><p>Preincrement</p></td>
  131. <td><p>++i</p></td>
  132. <td><p><span class="type">Iter &amp;</span></p></td>
  133. <td><p><code class="computeroutput">i</code> is incrementable (not
  134. off-the-end)</p></td>
  135. <td>&#160;</td>
  136. <td>&#160;</td>
  137. </tr>
  138. <tr>
  139. <td><p>Postincrement</p></td>
  140. <td><p>i++</p></td>
  141. <td><p></p></td>
  142. <td><p><code class="computeroutput">i</code> is incrementable (not
  143. off-the-end)</p></td>
  144. <td><p>Equivalent to <code class="computeroutput">(void)(++i)</code></p></td>
  145. <td><p><code class="computeroutput">i</code> is dereferenceable or
  146. off-the-end</p></td>
  147. </tr>
  148. <tr>
  149. <td><p>Postincrement and dereference</p></td>
  150. <td><p>*i++</p></td>
  151. <td><p>Convertible to <span class="type">value_type</span></p></td>
  152. <td><p><code class="computeroutput">i</code> is incrementable (not
  153. off-the-end)</p></td>
  154. <td><p>Equivalent to <code class="computeroutput">{value_type t = *i; ++i; return t;}</code></p></td>
  155. <td><p><code class="computeroutput">i</code> is dereferenceable or
  156. off-the-end</p></td>
  157. </tr>
  158. </tbody>
  159. </table></div>
  160. </div>
  161. <div class="refsect1">
  162. <a name="idm45853365518176"></a><h2>Complexity</h2>
  163. <p>
  164. All iterator operations must take amortized constant time.
  165. </p>
  166. </div>
  167. <div class="refsect1">
  168. <a name="idm45853365517536"></a><h2>Models</h2>
  169. <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="simplelist"><span class="type">std::istream_iterator</span></span></li></ul></div>
  170. </div>
  171. <div class="refsect1">
  172. <a name="idm45853365516144"></a><h2>See also</h2>
  173. <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
  174. <li class="listitem"><p><a class="link" href="DefaultConstructible.html" title="Concept DefaultConstructible">DefaultConstructible</a></p></li>
  175. <li class="listitem"><p><a class="link" href="EqualityComparable.html" title="Concept EqualityComparable">EqualityComparable</a></p></li>
  176. <li class="listitem"><p><a class="link" href="ForwardIterator.html" title="Concept ForwardIterator">ForwardIterator</a></p></li>
  177. <li class="listitem"><p><a class="link" href="OutputIterator.html" title="Concept OutputIterator">OutputIterator</a></p></li>
  178. </ul></div>
  179. </div>
  180. </div>
  181. <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
  182. <td align="left"></td>
  183. <td align="right"><div class="copyright-footer">Copyright &#169; 2001, 2002 Indiana University<br>Copyright &#169; 2000, 2001 University of Notre Dame du Lac<br>Copyright &#169; 2000 Jeremy Siek, Lie-Quan Lee, Andrew Lumsdaine<br>Copyright &#169; 1996-1999 Silicon Graphics Computer Systems, Inc.<br>Copyright &#169; 1994 Hewlett-Packard Company<p>Distributed under the Boost Software License, Version 1.0.
  184. (See accompanying file <code class="filename">LICENSE_1_0.txt</code> or copy at
  185. <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
  186. </p>
  187. <p>This product includes software developed at the University
  188. of Notre Dame and the Pervasive Technology Labs at Indiana
  189. University. For technical information contact Andrew Lumsdaine
  190. at the Pervasive Technology Labs at Indiana University. For
  191. administrative and license questions contact the Advanced
  192. Research and Technology Institute at 351 West 10th Street.
  193. Indianapolis, Indiana 46202, phone 317-278-4100, fax
  194. 317-274-5902.</p>
  195. <p>Some concepts based on versions from the MTL draft manual
  196. and Boost Graph and Property Map documentation, the SGI Standard
  197. Template Library documentation and the Hewlett-Packard STL,
  198. under the following license:
  199. </p>
  200. <div class="blockquote"><blockquote class="blockquote"><p>Permission to use, copy, modify, distribute and
  201. sell this software and its documentation for any purpose is
  202. hereby granted without fee, provided that the above copyright
  203. notice appears in all copies and that both that copyright
  204. notice and this permission notice appear in supporting
  205. documentation. Silicon Graphics makes no representations
  206. about the suitability of this software for any purpose. It is
  207. provided "as is" without express or implied
  208. warranty.</p></blockquote></div>
  209. </div></td>
  210. </tr></table>
  211. <hr>
  212. <div class="spirit-nav">
  213. <a accesskey="p" href="Assignable.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="index.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="OutputIterator.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
  214. </div>
  215. </body>
  216. </html>