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">
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="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>
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>
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
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>
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; ">
49 <p><span class="bold"><strong>value_type</strong></span></p>
50 <pre class="literallayout">std::iterator_traits<Iter>::value_type</pre>
51 <p>The value type of the iterator</p>
54 <p><span class="bold"><strong>category</strong></span></p>
55 <pre class="literallayout">std::iterator_traits<Iter>::iterator_category</pre>
56 <p>The category of the iterator</p>
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>
66 <span class="term"><code class="varname">i</code>, </span><span class="term"><code class="varname">j</code></span>
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>
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>.
82 <div class="refsect1">
83 <a name="idm45853365408640"></a><h2>Valid expressions</h2>
84 <div class="informaltable"><table class="table">
99 <th>Postcondition</th>
103 <td><p>Predecrement</p></td>
105 <td><p><span class="type">Iter &</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>
113 <td><p>Postdecrement</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
124 <div class="refsect1">
125 <a name="idm45853365398528"></a><h2>Complexity</h2>
127 All iterator operations must take amortized constant time.
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>
135 <code class="computeroutput">&i = &(--i)</code>
137 <dt><span class="term">Unique path through sequence</span></dt>
139 <code class="computeroutput">i == j</code> implies <code class="computeroutput">--i == --j</code>
141 <dt><span class="term">Increment and decrement are inverses</span></dt>
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.
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<T>::iterator</span></span></li>
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>
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 © 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.
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>)
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
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:
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>
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>