Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / concept_check / doc / html / BidirectionalIterator.html
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>Concept BidirectionalIterator</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="ForwardIterator.html" title="Concept ForwardIterator">
10 <link rel="next" href="RandomAccessIterator.html" title="Concept RandomAccessIterator">
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="ForwardIterator.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="RandomAccessIterator.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
24 </div>
25 <div class="refentry">
26 <a name="BidirectionalIterator"></a><div class="titlepage"></div>
27 <div class="refnamediv">
28 <h2><span class="refentrytitle">Concept BidirectionalIterator</span></h2>
29 <p>BidirectionalIterator</p>
30 </div>
31 <div class="refsect1">
32 <a name="idm45853365421824"></a><h2>Description</h2>
33 <p>A bidirectional iterator is an iterator that can read through a sequence
34   of values.  It can move in either direction through the sequence, and can
35   be either mutable (data pointed to by it can be changed) or not mutable.</p>
36 <p>An 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="idm45853365420048"></a><h2>Refinement of</h2>
43 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><a class="link" href="ForwardIterator.html" title="Concept ForwardIterator">ForwardIterator</a></p></li></ul></div>
44 </div>
45 <div class="refsect1">
46 <a name="idm45853365418784"></a><h2>Associated types</h2>
47 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
48 <li class="listitem">
49 <p><span class="bold"><strong>value_type</strong></span></p>
50 <pre class="literallayout">std::iterator_traits&lt;Iter&gt;::value_type</pre>
51 <p>The value type of the iterator</p>
52 </li>
53 <li class="listitem">
54 <p><span class="bold"><strong>category</strong></span></p>
55 <pre class="literallayout">std::iterator_traits&lt;Iter&gt;::iterator_category</pre>
56 <p>The category of the iterator</p>
57 </li>
58 </ul></div>
59 </div>
60 <div class="refsect1">
61 <a name="idm45853365414640"></a><h2>Notation</h2>
62 <div class="variablelist"><dl class="variablelist">
63 <dt><span class="term">Iter</span></dt>
64 <dd>A type playing the role of iterator-type in the <a class="link" href="BidirectionalIterator.html" title="Concept BidirectionalIterator">BidirectionalIterator</a> concept.</dd>
65 <dt>
66 <span class="term"><code class="varname">i</code>, </span><span class="term"><code class="varname">j</code></span>
67 </dt>
68 <dd>Objects of type Iter</dd>
69 <dt><span class="term"><code class="varname">x</code></span></dt>
70 <dd>Object of type value_type</dd>
71 </dl></div>
72 </div>
73 <div class="refsect1">
74 <a name="idm45853365410560"></a><h2>Type expressions</h2>
75 <div class="variablelist"><dl class="variablelist">
76 <dt><span class="term">Category tag</span></dt>
77 <dd><p><span class="type">category</span> must be
78                   derived from <span class="type">std::bidirectional_iterator_tag</span>.
79                 </p></dd>
80 </dl></div>
81 </div>
82 <div class="refsect1">
83 <a name="idm45853365408640"></a><h2>Valid expressions</h2>
84 <div class="informaltable"><table class="table">
85 <colgroup>
86 <col>
87 <col>
88 <col>
89 <col>
90 <col>
91 <col>
92 </colgroup>
93 <thead><tr>
94 <th>Name</th>
95 <th>Expression</th>
96 <th>Type</th>
97 <th>Precondition</th>
98 <th>Semantics</th>
99 <th>Postcondition</th>
100 </tr></thead>
101 <tbody>
102 <tr>
103 <td><p>Predecrement</p></td>
104 <td><p>--i</p></td>
105 <td><p><span class="type">Iter &amp;</span></p></td>
106 <td><p><code class="computeroutput">i</code> is incrementable (not
107     off-the-end) and some dereferenceable iterator <code class="computeroutput">j</code> exists
108     such that <code class="computeroutput">i == ++j</code></p></td>
109 <td>&#160;</td>
110 <td>&#160;</td>
111 </tr>
112 <tr>
113 <td><p>Postdecrement</p></td>
114 <td><p>i--</p></td>
115 <td><p><span class="type">Iter</span></p></td>
116 <td><p>Same as for predecrement</p></td>
117 <td><p>Equivalent to <code class="computeroutput">{Iter j = i; --i; return j;}</code></p></td>
118 <td><p><code class="computeroutput">i</code> is dereferenceable or
119     off-the-end</p></td>
120 </tr>
121 </tbody>
122 </table></div>
123 </div>
124 <div class="refsect1">
125 <a name="idm45853365398528"></a><h2>Complexity</h2>
126 <p>
127   All iterator operations must take amortized constant time.
128   </p>
129 </div>
130 <div class="refsect1">
131 <a name="idm45853365397808"></a><h2>Invariants</h2>
132 <div class="variablelist"><dl class="variablelist">
133 <dt><span class="term">Predecrement must return object</span></dt>
134 <dd><p>
135   <code class="computeroutput">&amp;i = &amp;(--i)</code>
136   </p></dd>
137 <dt><span class="term">Unique path through sequence</span></dt>
138 <dd><p>
139   <code class="computeroutput">i == j</code> implies <code class="computeroutput">--i == --j</code>
140   </p></dd>
141 <dt><span class="term">Increment and decrement are inverses</span></dt>
142 <dd><p>
143   <code class="computeroutput">++i; --i;</code> and <code class="computeroutput">--i; ++i;</code> must end up with the
144   value of <code class="computeroutput">i</code> unmodified, if <code class="computeroutput">i</code> both of the
145   operations in the pair are valid.
146   </p></dd>
147 </dl></div>
148 </div>
149 <div class="refsect1">
150 <a name="idm45853365390624"></a><h2>Models</h2>
151 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
152 <li class="listitem"><span class="simplelist"><span class="type">T *</span></span></li>
153 <li class="listitem"><span class="simplelist"><span class="type">std::list&lt;T&gt;::iterator</span></span></li>
154 </ul></div>
155 </div>
156 <div class="refsect1">
157 <a name="idm45853365388272"></a><h2>See also</h2>
158 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><a class="link" href="RandomAccessIterator.html" title="Concept RandomAccessIterator">RandomAccessIterator</a></p></li></ul></div>
159 </div>
160 </div>
161 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
162 <td align="left"></td>
163 <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.
164       (See accompanying file <code class="filename">LICENSE_1_0.txt</code> or copy at 
165       <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
166       </p>
167 <p>This product includes software developed at the University
168       of Notre Dame and the Pervasive Technology Labs at Indiana
169       University. For technical information contact Andrew Lumsdaine
170       at the Pervasive Technology Labs at Indiana University.  For
171       administrative and license questions contact the Advanced
172       Research and Technology Institute at 351 West 10th Street.
173       Indianapolis, Indiana 46202, phone 317-278-4100, fax
174       317-274-5902.</p>
175 <p>Some concepts based on versions from the MTL draft manual
176       and Boost Graph and Property Map documentation, the SGI Standard
177       Template Library documentation and the Hewlett-Packard STL,
178       under the following license: 
179         </p>
180 <div class="blockquote"><blockquote class="blockquote"><p>Permission to use, copy, modify, distribute and
181         sell this software and its documentation for any purpose is
182         hereby granted without fee, provided that the above copyright
183         notice appears in all copies and that both that copyright
184         notice and this permission notice appear in supporting
185         documentation.  Silicon Graphics makes no representations
186         about the suitability of this software for any purpose.  It is
187         provided "as is" without express or implied
188         warranty.</p></blockquote></div>
189 </div></td>
190 </tr></table>
191 <hr>
192 <div class="spirit-nav">
193 <a accesskey="p" href="ForwardIterator.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="RandomAccessIterator.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
194 </div>
195 </body>
196 </html>