3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
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.76.1">
7 <link rel="home" href="index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
8 <link rel="up" href="id319790-bb.html#concepts.reference" title="Concept reference">
9 <link rel="prev" href="InputIterator.html" title="Concept InputIterator">
10 <link rel="next" href="ForwardIterator.html" title="Concept ForwardIterator">
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>
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="id319790-bb.html#concepts.reference"><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>
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>
31 <div class="refsect1">
32 <a name="id1126732"></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>
41 <div class="refsect1">
42 <a name="id1126750"></a><h2>Associated types</h2>
43 <div class="itemizedlist"><ul class="itemizedlist" type="disc">
45 <p><span class="bold"><strong>value_type</strong></span></p>
46 <pre class="literallayout">std::iterator_traits<Iter>::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>
52 <p><span class="bold"><strong>difference_type</strong></span></p>
53 <pre class="literallayout">std::iterator_traits<Iter>::difference_type</pre>
54 <p>The difference type of the iterator</p>
57 <p><span class="bold"><strong>category</strong></span></p>
58 <pre class="literallayout">std::iterator_traits<Iter>::iterator_category</pre>
59 <p>The category of the iterator</p>
63 <div class="refsect1">
64 <a name="id1126815"></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 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>
71 <span class="term"><code class="varname">i</code>, </span><span class="term"><code class="varname">j</code></span>
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>
78 <div class="refsect1">
79 <a name="id1126867"></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 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>.
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>.
100 <div class="refsect1">
101 <a name="id1126985"></a><h2>Valid expressions</h2>
102 <div class="informaltable"><table class="table">
115 <th>Precondition</th>
117 <th>Postcondition</th>
121 <td><p>Dereference</p></td>
124 <td><p><code class="computeroutput">i</code> is incrementable (not
125 off-the-end)</p></td>
130 <td><p>Dereference and assign</p></td>
131 <td><p>*i = x</p></td>
133 <td><p><code class="computeroutput">i</code> is incrementable (not
134 off-the-end)</p></td>
136 <td><p><code class="computeroutput">*i</code> may not be written to again until it has
137 been incremented.</p></td>
140 <td><p>Preincrement</p></td>
142 <td><p><span class="type">Iter &</span></p></td>
143 <td><p><code class="computeroutput">i</code> is incrementable (not
144 off-the-end)</p></td>
149 <td><p>Postincrement</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
159 <td><p>Postincrement, dereference, and assign</p></td>
160 <td><p>*i++ = x</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
171 <div class="refsect1">
172 <a name="id1127152"></a><h2>Complexity</h2>
174 All iterator operations must take amortized constant time.
177 <div class="refsect1">
178 <a name="id1127158"></a><h2>Models</h2>
179 <div class="itemizedlist"><ul class="itemizedlist" 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>
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>)
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
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:
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>
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="id319790-bb.html#concepts.reference"><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>