1 | <?xml version="1.0" encoding="utf-8" ?> |
---|
2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
---|
3 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
---|
4 | <head> |
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
---|
6 | <meta name="generator" content="Docutils 0.5: http://docutils.sourceforge.net/" /> |
---|
7 | <title>Bidirectional Traversal Concept</title> |
---|
8 | <link rel="stylesheet" href="../../../rst.css" type="text/css" /> |
---|
9 | </head> |
---|
10 | <body> |
---|
11 | <div class="document" id="bidirectional-traversal-concept"> |
---|
12 | <h1 class="title">Bidirectional Traversal Concept</h1> |
---|
13 | |
---|
14 | <!-- Copyright David Abrahams 2006. Distributed under the Boost --> |
---|
15 | <!-- Software License, Version 1.0. (See accompanying --> |
---|
16 | <!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) --> |
---|
17 | <p>A class or built-in type <tt class="docutils literal"><span class="pre">X</span></tt> models the <em>Bidirectional Traversal</em> |
---|
18 | concept if, in addition to <tt class="docutils literal"><span class="pre">X</span></tt> meeting the requirements of Forward |
---|
19 | Traversal Iterator, the following expressions are valid and respect |
---|
20 | the stated semantics.</p> |
---|
21 | <table border="1" class="docutils"> |
---|
22 | <colgroup> |
---|
23 | <col width="38%" /> |
---|
24 | <col width="37%" /> |
---|
25 | <col width="25%" /> |
---|
26 | </colgroup> |
---|
27 | <thead valign="bottom"> |
---|
28 | <tr><th class="head" colspan="3">Bidirectional Traversal Iterator Requirements (in addition to Forward Traversal |
---|
29 | Iterator)</th> |
---|
30 | </tr> |
---|
31 | <tr><th class="head">Expression</th> |
---|
32 | <th class="head">Return Type</th> |
---|
33 | <th class="head">Assertion/Semantics / |
---|
34 | Pre-/Post-condition</th> |
---|
35 | </tr> |
---|
36 | </thead> |
---|
37 | <tbody valign="top"> |
---|
38 | <tr><td><tt class="docutils literal"><span class="pre">--r</span></tt></td> |
---|
39 | <td><tt class="docutils literal"><span class="pre">X&</span></tt></td> |
---|
40 | <td>pre: there exists |
---|
41 | <tt class="docutils literal"><span class="pre">s</span></tt> such that <tt class="docutils literal"><span class="pre">r</span> |
---|
42 | <span class="pre">==</span> <span class="pre">++s</span></tt>. post: |
---|
43 | <tt class="docutils literal"><span class="pre">s</span></tt> is |
---|
44 | dereferenceable. |
---|
45 | <tt class="docutils literal"><span class="pre">--(++r)</span> <span class="pre">==</span> <span class="pre">r</span></tt>. |
---|
46 | <tt class="docutils literal"><span class="pre">--r</span> <span class="pre">==</span> <span class="pre">--s</span></tt> |
---|
47 | implies <tt class="docutils literal"><span class="pre">r</span> <span class="pre">==</span> |
---|
48 | <span class="pre">s</span></tt>. <tt class="docutils literal"><span class="pre">&r</span> <span class="pre">==</span> <span class="pre">&--r</span></tt>.</td> |
---|
49 | </tr> |
---|
50 | <tr><td><tt class="docutils literal"><span class="pre">r--</span></tt></td> |
---|
51 | <td>convertible to <tt class="docutils literal"><span class="pre">const</span> <span class="pre">X&</span></tt></td> |
---|
52 | <td><pre class="first last literal-block"> |
---|
53 | { |
---|
54 | X tmp = r; |
---|
55 | --r; |
---|
56 | return tmp; |
---|
57 | } |
---|
58 | </pre> |
---|
59 | </td> |
---|
60 | </tr> |
---|
61 | <tr><td><tt class="docutils literal"><span class="pre">iterator_traversal<X>::type</span></tt></td> |
---|
62 | <td>Convertible to |
---|
63 | <tt class="docutils literal"><span class="pre">bidirectional_traversal_tag</span></tt></td> |
---|
64 | <td> </td> |
---|
65 | </tr> |
---|
66 | </tbody> |
---|
67 | </table> |
---|
68 | </div> |
---|
69 | <div class="footer"> |
---|
70 | <hr class="footer" /> |
---|
71 | <a class="reference external" href="BidirectionalTraversal.rst">View document source</a>. |
---|
72 | Generated by <a class="reference external" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source. |
---|
73 | |
---|
74 | </div> |
---|
75 | </body> |
---|
76 | </html> |
---|