• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>Concept OutputIterator</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="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%"><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="InputIterator.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="ForwardIterator.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="refentry">
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">
32<a name="idm45301721958752"></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">
42<a name="idm45301721957024"></a><h2>Associated types</h2>
43<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
44<li class="listitem">
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 class="listitem">
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 class="listitem">
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">
64<a name="idm45301721950512"></a><h2>Notation</h2>
65<div class="variablelist"><dl class="variablelist">
66<dt><span class="term">Iter</span></dt>
67<dd>A type playing the role of iterator-type in the <a class="link" 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 class="link" 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">
79<a name="idm45301721945040"></a><h2>Type expressions</h2>
80<div class="variablelist"><dl class="variablelist">
81<dt><span class="term"></span></dt>
82<dd><p>The type <span class="type">Iter</span> must be a model of <a class="link" 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 class="link" 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 class="link" 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 class="link" 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 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>.
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="idm45301721933632"></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">
172<a name="idm45301721915376"></a><h2>Complexity</h2>
173<p>
174  All iterator operations must take amortized constant time.
175  </p>
176</div>
177<div class="refsect1">
178<a name="idm45301721914736"></a><h2>Models</h2>
179<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
180<li class="listitem"><span class="simplelist"><span class="type">std::ostream_iterator</span>, <span class="type">...</span></span></li>
181<li class="listitem"><span class="simplelist"><span class="type">std::insert_iterator</span>, <span class="type">...</span></span></li>
182<li class="listitem"><span class="simplelist"><span class="type">std::front_insert_iterator</span>, <span class="type">...</span></span></li>
183<li class="listitem"><span class="simplelist"><span class="type">std::back_insert_iterator</span>, <span class="type">...</span></span></li>
184</ul></div>
185</div>
186</div>
187<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
188<td align="left"></td>
189<td align="right"><div class="copyright-footer">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<p>Distributed under the Boost Software License, Version 1.0.
190      (See accompanying file <code class="filename">LICENSE_1_0.txt</code> or copy at
191      <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
192      </p>
193<p>This product includes software developed at the University
194      of Notre Dame and the Pervasive Technology Labs at Indiana
195      University. For technical information contact Andrew Lumsdaine
196      at the Pervasive Technology Labs at Indiana University.  For
197      administrative and license questions contact the Advanced
198      Research and Technology Institute at 351 West 10th Street.
199      Indianapolis, Indiana 46202, phone 317-278-4100, fax
200      317-274-5902.</p>
201<p>Some concepts based on versions from the MTL draft manual
202      and Boost Graph and Property Map documentation, the SGI Standard
203      Template Library documentation and the Hewlett-Packard STL,
204      under the following license:
205        </p>
206<div class="blockquote"><blockquote class="blockquote"><p>Permission to use, copy, modify, distribute and
207        sell this software and its documentation for any purpose is
208        hereby granted without fee, provided that the above copyright
209        notice appears in all copies and that both that copyright
210        notice and this permission notice appear in supporting
211        documentation.  Silicon Graphics makes no representations
212        about the suitability of this software for any purpose.  It is
213        provided "as is" without express or implied
214        warranty.</p></blockquote></div>
215</div></td>
216</tr></table>
217<hr>
218<div class="spirit-nav">
219<a accesskey="p" href="InputIterator.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="ForwardIterator.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
220</div>
221</body>
222</html>
223