Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/doc/html/OutputIterator.html @ 12

Last change on this file since 12 was 12, checked in by landauf, 17 years ago

added boost

File size: 8.7 KB
Line 
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
4<title>Concept OutputIterator</title>
5<link rel="stylesheet" href="boostbook.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
7<link rel="start" href="index.html" title="The Boost C++ Libraries">
8<link rel="up" href="concepts/reference.html" title="Concept reference">
9<link rel="prev" href="InputIterator.html" title="Concept InputIterator">
10<link rel="next" href="ForwardIterator.html" title="Concept ForwardIterator">
11</head>
12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13<table cellpadding="2" width="100%">
14<td valign="top"><img alt="boost.png (6897 bytes)" width="277" height="86" src="../../boost.png"></td>
15<td align="center"><a href="../../index.htm">Home</a></td>
16<td align="center"><a href="../../libs/libraries.htm">Libraries</a></td>
17<td align="center"><a href="../../people/people.htm">People</a></td>
18<td align="center"><a href="../../more/faq.htm">FAQ</a></td>
19<td align="center"><a href="../../more/index.htm">More</a></td>
20</table>
21<hr>
22<div class="spirit-nav">
23<a accesskey="p" href="InputIterator.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="concepts/reference.html"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="ForwardIterator.html"><img src="images/next.png" alt="Next"></a>
24</div>
25<div class="refentry" lang="en">
26<a name="OutputIterator"></a><div class="titlepage"></div>
27<div class="refnamediv">
28<h2><span class="refentrytitle">Concept OutputIterator</span></h2>
29<p>OutputIterator</p>
30</div>
31<div class="refsect1" lang="en">
32<a name="id2576510"></a><h2>Description</h2>
33<p>An output iterator is an iterator that can write a sequence of
34  values.  It is single-pass (old values of the iterator cannot be
35  re-used), and write-only.</p>
36<p>An output iterator represents a position in a (possibly infinite)
37  sequence.  Therefore, the iterator can point into the sequence (returning
38  a value when dereferenced and being incrementable), or be off-the-end
39  (and not dereferenceable or incrementable).</p>
40</div>
41<div class="refsect1" lang="en">
42<a name="id2576525"></a><h2>Associated types</h2>
43<div class="itemizedlist"><ul type="disc">
44<li>
45<p><span class="bold"><strong>value_type</strong></span></p>
46<pre class="literallayout">std::iterator_traits&lt;Iter&gt;::value_type</pre>
47<p>The stated value type of the iterator (should be
48    <code class="computeroutput">void</code> for an output iterator that does not model some other
49    iterator concept).</p>
50</li>
51<li>
52<p><span class="bold"><strong>difference_type</strong></span></p>
53<pre class="literallayout">std::iterator_traits&lt;Iter&gt;::difference_type</pre>
54<p>The difference type of the iterator</p>
55</li>
56<li>
57<p><span class="bold"><strong>category</strong></span></p>
58<pre class="literallayout">std::iterator_traits&lt;Iter&gt;::iterator_category</pre>
59<p>The category of the iterator</p>
60</li>
61</ul></div>
62</div>
63<div class="refsect1" lang="en">
64<a name="id2576590"></a><h2>Notation</h2>
65<div class="variablelist"><dl>
66<dt><span class="term">Iter</span></dt>
67<dd>A type playing the role of iterator-type in the <a href="OutputIterator.html" title="Concept OutputIterator">OutputIterator</a> concept.</dd>
68<dt><span class="term">ValueType</span></dt>
69<dd>A type playing the role of value-type in the <a href="OutputIterator.html" title="Concept OutputIterator">OutputIterator</a> concept.</dd>
70<dt>
71<span class="term"><code class="varname">i</code>, </span><span class="term"><code class="varname">j</code></span>
72</dt>
73<dd>Objects of type Iter</dd>
74<dt><span class="term"><code class="varname">x</code></span></dt>
75<dd>Object of type ValueType</dd>
76</dl></div>
77</div>
78<div class="refsect1" lang="en">
79<a name="id2576644"></a><h2>Type expressions</h2>
80<div class="variablelist"><dl>
81<dt><span class="term"></span></dt>
82<dd><p>The type <span class="type">Iter</span> must be a model of <a href="Assignable.html" title="Concept Assignable">Assignable</a>.</p></dd>
83<dt><span class="term"></span></dt>
84<dd><p>The type <span class="type">ValueType</span> must be a model of <a href="Assignable.html" title="Concept Assignable">Assignable</a>.</p></dd>
85<dt><span class="term"></span></dt>
86<dd><p>The type <span class="type">Iter</span> must be a model of <a href="DefaultConstructible.html" title="Concept DefaultConstructible">DefaultConstructible</a>.</p></dd>
87<dt><span class="term"></span></dt>
88<dd><p>The type <span class="type">Iter</span> must be a model of
89  <a href="EqualityComparable.html" title="Concept EqualityComparable">EqualityComparable</a>.</p></dd>
90<dt><span class="term">Category tag</span></dt>
91<dd><p><span class="type">category</span> must be
92                  derived from <span class="type">std::output_iterator_tag</span>,  a model  of <a href="DefaultConstructible.html" title="Concept DefaultConstructible">DefaultConstructible</a>,  and  a model  of <a 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 href="SignedInteger.html" title="Concept SignedInteger">SignedInteger</a>.
97                </p></dd>
98</dl></div>
99</div>
100<div class="refsect1" lang="en">
101<a name="id2576762"></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></p></td>
124<td><p><code class="computeroutput">i</code> is incrementable (not
125    off-the-end)</p></td>
126<td> </td>
127<td> </td>
128</tr>
129<tr>
130<td><p>Dereference and assign</p></td>
131<td><p>*i = x</p></td>
132<td><p></p></td>
133<td><p><code class="computeroutput">i</code> is incrementable (not
134    off-the-end)</p></td>
135<td> </td>
136<td><p><code class="computeroutput">*i</code> may not be written to again until it has
137    been incremented.</p></td>
138</tr>
139<tr>
140<td><p>Preincrement</p></td>
141<td><p>++i</p></td>
142<td><p><span class="type">Iter &amp;</span></p></td>
143<td><p><code class="computeroutput">i</code> is incrementable (not
144    off-the-end)</p></td>
145<td> </td>
146<td> </td>
147</tr>
148<tr>
149<td><p>Postincrement</p></td>
150<td><p>i++</p></td>
151<td><p></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">(void)(++i)</code></p></td>
155<td><p><code class="computeroutput">i</code> is dereferenceable or
156    off-the-end</p></td>
157</tr>
158<tr>
159<td><p>Postincrement, dereference, and assign</p></td>
160<td><p>*i++ = x</p></td>
161<td><p></p></td>
162<td><p><code class="computeroutput">i</code> is incrementable (not
163    off-the-end)</p></td>
164<td><p>Equivalent to <code class="computeroutput">{*i = t; ++i;}</code></p></td>
165<td><p><code class="computeroutput">i</code> is dereferenceable or
166    off-the-end</p></td>
167</tr>
168</tbody>
169</table></div>
170</div>
171<div class="refsect1" lang="en">
172<a name="id2576931"></a><h2>Complexity</h2>
173<p>
174  All iterator operations must take amortized constant time.
175  </p>
176</div>
177<div class="refsect1" lang="en">
178<a name="id2576937"></a><h2>Models</h2>
179<div class="itemizedlist"><ul type="disc">
180<li><span class="simplelist"><span class="type">std::ostream_iterator</span>, <span class="type">...</span></span></li>
181<li><span class="simplelist"><span class="type">std::insert_iterator</span>, <span class="type">...</span></span></li>
182<li><span class="simplelist"><span class="type">std::front_insert_iterator</span>, <span class="type">...</span></span></li>
183<li><span class="simplelist"><span class="type">std::back_insert_iterator</span>, <span class="type">...</span></span></li>
184</ul></div>
185</div>
186<div class="refsect1" lang="en">
187<a name="id2576987"></a><h2>See also</h2>
188<div class="itemizedlist"><ul type="disc"></ul></div>
189</div>
190</div>
191<table width="100%"><tr>
192<td align="left"></td>
193<td align="right"><small>Copyright © 2001, 2002 Indiana University<br>Copyright © 2000, 2001 University of Notre Dame du Lac<br>Copyright © 2000 Jeremy Siek, Lie-Quan Lee, Andrew Lumsdaine<br>Copyright © 1996-1999 Silicon Graphics Computer Systems, Inc.<br>Copyright © 1994 Hewlett-Packard Company</small></td>
194</tr></table>
195<hr>
196<div class="spirit-nav">
197<a accesskey="p" href="InputIterator.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="concepts/reference.html"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="ForwardIterator.html"><img src="images/next.png" alt="Next"></a>
198</div>
199</body>
200</html>
Note: See TracBrowser for help on using the repository browser.