1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168 |
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta name="generator" content=
- "HTML Tidy for Linux/x86 (vers 1st March 2004), see www.w3.org" />
- <meta http-equiv="Content-Type" content=
- "text/html; charset=us-ascii" />
- <link rel="stylesheet" href="../../../../boost.css" type="text/css"/>
- <link rel="stylesheet" href="ublas.css" type="text/css" />
- <script type="text/javascript" src="js/jquery-1.3.2.min.js" async="async" ></script>
- <script type="text/javascript" src="js/jquery.toc-gw.js" async="async" ></script>
- <title>Iterator Concepts</title>
- </head>
- <body>
- <h1><img src="../../../../boost.png" align="middle" />Iterator Concepts</h1>
- <div class="toc" id="toc"></div>
- <p>An Iterator is a restricted pointer-like object pointing into a
- vector or matrix container.</p>
- <h2><a name="indexed_bidirectional_iterator"
- ></a>Indexed Bidirectional Iterator</h2>
- <h4>Description</h4>
- <p>An Indexed Bidirectional Iterator is an iterator of a container
- that can be dereferenced, incremented, decremented and carries
- index information.</p>
- <h4>Refinement of</h4>
- <p>Assignable, Equality Comparable, Default Constructible.</p>
- <h4>Associated types</h4>
- <table border="1" summary="associated types">
- <tbody>
- <tr>
- <td>Value type</td>
- <td>The type of the value obtained by dereferencing a Indexed
- Bidirectional Iterator</td>
- </tr>
- <tr>
- <td>Container type</td>
- <td>The type of the container a Indexed Bidirectional Iterator
- points into.</td>
- </tr>
- </tbody>
- </table>
- <h4>Notation</h4>
- <table border="0" summary="notation">
- <tbody>
- <tr>
- <td><code>I</code></td>
- <td>A type that is a model of Indexed Bidirectional Iterator</td>
- </tr>
- <tr>
- <td><code>T</code></td>
- <td>The value type of <code>I</code></td>
- </tr>
- <tr>
- <td><code>C</code></td>
- <td>The container type of <code>I</code></td>
- </tr>
- <tr>
- <td><code>it</code>, <code>itt, it1</code>, <code>it2</code></td>
- <td>Objects of type <code>I</code></td>
- </tr>
- <tr>
- <td><code>t</code></td>
- <td>Object of type <code>T</code></td>
- </tr>
- <tr>
- <td><code>c</code></td>
- <td>Object of type <code>C</code></td>
- </tr>
- </tbody>
- </table>
- <h4>Definitions</h4>
- <p>A Indexed Bidirectional Iterator may be <i>mutable</i>, meaning
- that the values referred to by objects of that type may be
- modified, or <i>constant</i> , meaning that they may not. If an
- iterator type is mutable, this implies that its value type is a
- model of Assignable; the converse, though, is not necessarily
- true.</p>
- <p>A Indexed Bidirectional Iterator may have a <i>singular</i>
- value, meaning that the results of most operations, including
- comparison for equality, are undefined. The only operation that is
- guaranteed to be supported is assigning a nonsingular iterator to a
- singular iterator.</p>
- <p>A Indexed Bidirectional Iterator may have a
- <i>dereferenceable</i> value, meaning that dereferencing it yields
- a well-defined value. Dereferenceable iterators are always
- nonsingular, but the converse is not true.</p>
- <p>An Indexed Bidirectional Iterator is <i>past-the-end</i> if it
- points beyond the last element of a container. Past-the-end values
- are nonsingular and nondereferenceable.</p>
- <h4>Valid expressions</h4>
- <p>In addition to the expressions defined for Assignable, Equality
- Comparable and Default Constructible, the following expressions
- must be valid.</p>
- <table border="1" summary="expressions">
- <tbody>
- <tr>
- <th>Name</th>
- <th>Expression</th>
- <th>Type requirements</th>
- <th>Return type</th>
- </tr>
- <tr>
- <td>Default constructor</td>
- <td><code>I it</code></td>
- <td> </td>
- <td> </td>
- </tr>
- <tr>
- <td>Dereference</td>
- <td><code>*it</code></td>
- <td> </td>
- <td>Convertible to <code>T</code>.</td>
- </tr>
- <tr>
- <td>Dereference assignment</td>
- <td><code>*it = t</code></td>
- <td><code>I</code> is mutable.</td>
- <td> </td>
- </tr>
- <tr>
- <td>Member access</td>
- <td><code>it->m</code></td>
- <td><code>T</code> is a type for which <code>t.m</code> is
- defined.</td>
- <td> </td>
- </tr>
- <tr>
- <td>Preincrement</td>
- <td><code>++ it</code></td>
- <td> </td>
- <td><code>I &</code></td>
- </tr>
- <tr>
- <td>Postincrement</td>
- <td><code>it ++</code></td>
- <td> </td>
- <td><code>I</code></td>
- </tr>
- <tr>
- <td>Predecrement</td>
- <td><code>-- it</code></td>
- <td> </td>
- <td><code>I &</code></td>
- </tr>
- <tr>
- <td>Postdecrement</td>
- <td><code>it --</code></td>
- <td> </td>
- <td><code>I</code></td>
- </tr>
- <tr>
- <td>Index</td>
- <td><code>it.index ()</code></td>
- <td> </td>
- <td><code>C::size_type</code></td>
- </tr>
- </tbody>
- </table>
- <h4>Expression Semantics</h4>
- <p>Semantics of an expression is defined only where it differs
- from, or is not defined in, Assignable, Equality Comparable and
- Default Constructible.</p>
- <table border="1" summary="semantics">
- <tbody>
- <tr>
- <th>Name</th>
- <th>Expression</th>
- <th>Precondition</th>
- <th>Semantics</th>
- <th>Postcondition</th>
- </tr>
- <tr>
- <td>Default constructor</td>
- <td><code>I it</code></td>
- <td> </td>
- <td> </td>
- <td><code>it</code> is singular.</td>
- </tr>
- <tr>
- <td>Dereference</td>
- <td><code>*it</code></td>
- <td><code>it</code> is dereferenceable.</td>
- <td> </td>
- <td> </td>
- </tr>
- <tr>
- <td>Dereference assignment</td>
- <td><code>*it = t</code></td>
- <td>Same as for <code>*it</code>.</td>
- <td> </td>
- <td><code>*it</code> is a copy of t.</td>
- </tr>
- <tr>
- <td>Member access</td>
- <td><code>it->m</code></td>
- <td><code>it</code> is dereferenceable.</td>
- <td>Equivalent to <code>(*it).m</code></td>
- <td> </td>
- </tr>
- <tr>
- <td>Preincrement</td>
- <td><code>++ it</code></td>
- <td><code>it</code> is dereferenceable.</td>
- <td><code>it</code> is modified to point to the next element.</td>
- <td><code>it</code> is dereferenceable or past-the-end.
- <code><br />
- &it == &++ it</code>.<br />
- If <code>it1 == it2</code>,<br />
- then <code>++ it1 == ++ it2</code>.</td>
- </tr>
- <tr>
- <td>Postincrement</td>
- <td><code>it ++</code></td>
- <td>Same as for <code>++ it</code>.</td>
- <td>Equivalent to<br />
- <code>{<br />
- I itt = it;<br />
- ++ it;<br />
- return itt;<br />
- }</code></td>
- <td><code>it</code> is dereferenceable or past-the-end.</td>
- </tr>
- <tr>
- <td>Predecrement</td>
- <td><code>-- it</code></td>
- <td><code>it</code> is dereferenceable or past-the-end.<br />
- There exists a dereferenceable iterator <code>itt</code> such that
- <code>it == ++ itt</code>.</td>
- <td><code>it</code> is modified to point to the previous
- element.</td>
- <td><code>it</code> is dereferenceable.<br />
- <code>&it = &-- it</code>.<br />
- If <code>it1 == it2</code>,<br />
- then <code>-- it1 == -- it2</code>.<br />
- If <code>it2</code> is dereferenceable and <code>it1 ==
- ++it2</code>,<br />
- then <code>--it1 == it2</code>.</td>
- </tr>
- <tr>
- <td>Postdecrement</td>
- <td><code>it --</code></td>
- <td>Same as for -- <code>it</code>.</td>
- <td>Equivalent to<br />
- <code>{<br />
- I itt = it;<br />
- -- it;<br />
- return itt;<br />
- }</code></td>
- <td><code>it</code> is dereferenceable. </td>
- </tr>
- <tr>
- <td>Index</td>
- <td><code>it.index ()</code></td>
- <td><code>it</code> is dereferenceable.</td>
- <td><code>it.index () >= 0</code><br />
- and<br />
- <code>it.index () < it ().size ()</code></td>
- <td>If <code>it1 == it2</code>,<br />
- then <code>it1.index () == it2.index ()</code>.<br />
- If <code>it1 == it2</code>,<br />
- then <code>it1.index () < (++ it2).index
- ()</code>.<br />
- If <code>it1 == it2</code>,<br />
- then <code>it1.index () > (-- it2).index
- ()</code>.</td>
- </tr>
- </tbody>
- </table>
- <h4>Complexity guarantees</h4>
- <p>The complexity of operations on indexed bidirectional iterators
- is guaranteed to be amortized constant time.</p>
- <h4>Invariants</h4>
- <table border="1" summary="invariants">
- <tbody>
- <tr>
- <td>Identity</td>
- <td><code>it1 == it2</code> if and only if <code>&*it1 ==
- &*it2</code>.</td>
- </tr>
- <tr>
- <td>Symmetry of increment and decrement</td>
- <td>If <code>it</code> is dereferenceable, then <code>++ it;
- --it;</code> is a null operation. Similarly, <code>-- it; ++
- it;</code> is a null operation.</td>
- </tr>
- <tr>
- <td>Relation between iterator index and container element
- operator</td>
- <td>If <code>it</code> is dereferenceable, <code>*it == it ()
- (it.index ())</code>.</td>
- </tr>
- </tbody>
- </table>
- <h4>Models</h4>
- <ul>
- <li><code>sparse_vector::iterator</code></li>
- </ul>
- <h2><a name="indexed_random_access_iterator"
- ></a>Indexed Random Access Iterator</h2>
- <h4>Description</h4>
- <p>An Indexed Random Access Iterator is an iterator of a container
- that can be dereferenced, moved forward, moved backward and carries
- index information.</p>
- <h4>Refinement of</h4>
- <p>LessThanComparable, <a href=
- "#indexed_bidirectional_iterator">Indexed Bidirectional
- Iterator</a> .</p>
- <h4>Associated types</h4>
- <table border="1" summary="associated types">
- <tbody>
- <tr>
- <td>Value type</td>
- <td>The type of the value obtained by dereferencing a Indexed
- Random Access Iterator</td>
- </tr>
- <tr>
- <td>Container type</td>
- <td>The type of the container a Indexed Random Access Iterator
- points into.</td>
- </tr>
- </tbody>
- </table>
- <h4>Notation</h4>
- <table border="0" summary="notation">
- <tbody>
- <tr>
- <td><code>I</code></td>
- <td>A type that is a model of Indexed Random Access Iterator</td>
- </tr>
- <tr>
- <td><code>T</code></td>
- <td>The value type of <code>I</code></td>
- </tr>
- <tr>
- <td><code>C</code></td>
- <td>The container type of <code>I</code></td>
- </tr>
- <tr>
- <td><code>it</code>, <code>itt, it1</code>, <code>it2</code></td>
- <td>Objects of type <code>I</code></td>
- </tr>
- <tr>
- <td><code>t</code></td>
- <td>Object of type <code>T</code></td>
- </tr>
- <tr>
- <td><code>n</code></td>
- <td>Object of type <code>C::difference_type</code></td>
- </tr>
- </tbody>
- </table>
- <h4>Definitions</h4>
- <p>An Indexed Random Access Iterator <code>it1</code> is
- <i>reachable</i> from an Indexed Random Access Iterator
- <code>it2</code> if, after applying <code>operator ++</code> to
- <code>it2</code> a finite number of times, <code>it1 ==
- it2</code>.</p>
- <h4>Valid expressions</h4>
- <p>In addition to the expressions defined for <a href=
- "#indexed_bidirectional_iterator">Indexed Bidirectional
- Iterator</a> , the following expressions must be valid.</p>
- <table border="1" summary="expressions">
- <tbody>
- <tr>
- <th>Name</th>
- <th>Expression</th>
- <th>Type requirements</th>
- <th>Return type</th>
- </tr>
- <tr>
- <td>Forward motion</td>
- <td><code>it += n</code></td>
- <td> </td>
- <td><code>I &</code></td>
- </tr>
- <tr>
- <td>Iterator addition</td>
- <td><code>it + n</code></td>
- <td> </td>
- <td><code>I</code></td>
- </tr>
- <tr>
- <td>Backward motion</td>
- <td><code>i -= n</code></td>
- <td> </td>
- <td><code>I &</code></td>
- </tr>
- <tr>
- <td>Iterator subtraction</td>
- <td><code>it - n</code></td>
- <td> </td>
- <td><code>I</code> </td>
- </tr>
- <tr>
- <td>Difference</td>
- <td><code>it1 - it2</code></td>
- <td> </td>
- <td><code>C::difference_type</code></td>
- </tr>
- <tr>
- <td>Element operator</td>
- <td><code>it [n]</code></td>
- <td> </td>
- <td>Convertible to <code>T</code>.</td>
- </tr>
- <tr>
- <td>Element assignment</td>
- <td><code>it [n] = t</code></td>
- <td><code>I</code> is mutable</td>
- <td>Convertible to <code>T</code>.</td>
- </tr>
- </tbody>
- </table>
- <h4>Expression Semantics</h4>
- <p>Semantics of an expression is defined only where it differs
- from, or is not defined in, <a href=
- "#indexed_bidirectional_iterator">Indexed Bidirectional
- Iterator</a> .</p>
- <table border="1" summary="semantics">
- <tbody>
- <tr>
- <th>Name</th>
- <th>Expression</th>
- <th>Precondition</th>
- <th>Semantics</th>
- <th>Postcondition</th>
- </tr>
- <tr>
- <td>Forward motion</td>
- <td><code>it += n</code></td>
- <td>Including <code>it</code> itself, there must be <code>n</code>
- dereferenceable or past-the-end iterators following or preceding
- <code>it</code>, depending on whether <code>n</code> is positive or
- negative.</td>
- <td>If <code>n > 0</code>, equivalent to executing <code>++
- it</code> <code>n</code> times. If <code>n < 0</code>,
- equivalent to executing <code>-- it</code> <code>n</code> times. If
- <code>n == 0</code>, this is a null operation.</td>
- <td><code>it</code> is dereferenceable or past-the-end.</td>
- </tr>
- <tr>
- <td>Iterator addition</td>
- <td><code>it + n</code></td>
- <td>Same as for <code>i += n</code>.</td>
- <td>Equivalent to<br />
- <code>{<br />
- I itt = it;<br />
- return itt += n;<br />
- }</code></td>
- <td>Result is dereferenceable or past-the-end.</td>
- </tr>
- <tr>
- <td>Backward motion</td>
- <td><code>it -= n</code></td>
- <td>Including <code>it</code> itself, there must be <code>n</code>
- dereferenceable or past-the-end iterators preceding or following
- <code>it</code>, depending on whether <code>n</code> is positive or
- negative.</td>
- <td>Equivalent to <code>it += (-n)</code>.</td>
- <td><code>it</code> is dereferenceable or past-the-end.</td>
- </tr>
- <tr>
- <td>Iterator subtraction</td>
- <td><code>it - n</code></td>
- <td>Same as for <code>i -= n</code>.</td>
- <td>Equivalent to<br />
- <code>{<br />
- I itt = it;<br />
- return itt -= n;<br />
- }</code></td>
- <td>Result is dereferenceable or past-the-end.</td>
- </tr>
- <tr>
- <td>Difference</td>
- <td><code>it1 - it2</code></td>
- <td>Either <code>it1</code> is reachable from <code>it2</code> or
- <code>it2</code> is reachable from <code>it1</code>, or both.</td>
- <td>Returns a number <code>n</code> such that <code>it1 == it2 +
- n</code></td>
- <td> </td>
- </tr>
- <tr>
- <td>Element operator</td>
- <td><code>it [n]</code></td>
- <td><code>it + n</code> exists and is dereferenceable.</td>
- <td>Equivalent to <code>*(it + n)</code></td>
- <td> </td>
- </tr>
- <tr>
- <td>Element assignment</td>
- <td><code>i[n] = t</code></td>
- <td>Same as for <code>it [n]</code>.</td>
- <td>Equivalent to <code>*(it + n) = t</code></td>
- <td> </td>
- </tr>
- </tbody>
- </table>
- <h4>Complexity guarantees</h4>
- <p>The complexity of operations on indexed random access iterators
- is guaranteed to be amortized constant time.</p>
- <h4>Invariants</h4>
- <table border="1" summary="invariants">
- <tbody>
- <tr>
- <td>Symmetry of addition and subtraction</td>
- <td>If <code>it + n</code> is well-defined, then <code>it += n; it
- -= n;</code> and <code>(it + n) - n</code> are null operations.
- Similarly, if <code>it - n</code> is well-defined, then <code>it -=
- n; it += n;</code> and <code>(it - n) + n</code> are null
- operations.</td>
- </tr>
- <tr>
- <td>Relation between distance and addition</td>
- <td>If <code>it1 - it2</code> is well-defined, then <code>it1 ==
- it2 + (it1 - it2)</code>.</td>
- </tr>
- <tr>
- <td>Reachability and distance</td>
- <td>If <code>it1</code> is reachable from <code>it2</code>, then
- <code>it1 - it2 >= 0</code>.</td>
- </tr>
- </tbody>
- </table>
- <h4>Models</h4>
- <ul>
- <li><code>vector::iterator</code></li>
- </ul>
- <h2><a name="indexed_bidirectional_cr_iterator"
- ></a>Indexed Bidirectional Column/Row Iterator</h2>
- <h4>Description</h4>
- <p>An Indexed Bidirectional Column/Row Iterator is an iterator of a
- container that can be dereferenced, incremented, decremented and
- carries index information.</p>
- <h4>Refinement of</h4>
- <p>Assignable, Equality Comparable, Default Constructible.</p>
- <h4>Associated types</h4>
- <table border="1" summary="associated types">
- <tbody>
- <tr>
- <td>Value type</td>
- <td>The type of the value obtained by dereferencing a Indexed
- Bidirectional Column/Row Iterator</td>
- </tr>
- <tr>
- <td>Container type</td>
- <td>The type of the container a Indexed Bidirectional Column/Row
- Iterator points into.</td>
- </tr>
- </tbody>
- </table>
- <h4>Notation</h4>
- <table border="0" summary="notation">
- <tbody>
- <tr>
- <td><code>I1</code></td>
- <td>A type that is a model of Indexed Bidirectional Column/Row
- Iterator</td>
- </tr>
- <tr>
- <td><code>I2</code></td>
- <td>A type that is a model of Indexed Bidirectional Row/Column
- Iterator</td>
- </tr>
- <tr>
- <td><code>T</code></td>
- <td>The value type of <code>I1</code> and <code>I2</code></td>
- </tr>
- <tr>
- <td><code>C</code></td>
- <td>The container type of <code>I1</code> and <code>I2</code></td>
- </tr>
- <tr>
- <td><code>it1</code>, <code>it1t, it11</code>,
- <code>it12</code></td>
- <td>Objects of type <code>I1</code></td>
- </tr>
- <tr>
- <td><code>it2</code>, <code>it2t</code></td>
- <td>Objects of type <code>I2</code></td>
- </tr>
- <tr>
- <td><code>t</code></td>
- <td>Object of type <code>T</code></td>
- </tr>
- <tr>
- <td><code>c</code></td>
- <td>Object of type <code>C</code></td>
- </tr>
- </tbody>
- </table>
- <h4>Definitions</h4>
- <h4>Valid expressions</h4>
- <p>In addition to the expressions defined for Assignable, Equality
- Comparable and Default Constructible, the following expressions
- must be valid.</p>
- <table border="1" summary="expressions">
- <tbody>
- <tr>
- <th>Name</th>
- <th>Expression</th>
- <th>Type requirements</th>
- <th>Return type</th>
- </tr>
- <tr>
- <td>Default constructor</td>
- <td><code>I1 it</code></td>
- <td> </td>
- <td> </td>
- </tr>
- <tr>
- <td>Dereference</td>
- <td><code>*it</code></td>
- <td> </td>
- <td>Convertible to <code>T</code>.</td>
- </tr>
- <tr>
- <td>Dereference assignment</td>
- <td><code>*it = t</code></td>
- <td><code>I1</code> is mutable.</td>
- <td> </td>
- </tr>
- <tr>
- <td>Member access</td>
- <td><code>it->m</code></td>
- <td><code>T</code> is a type for which <code>t.m</code> is
- defined.</td>
- <td> </td>
- </tr>
- <tr>
- <td>Preincrement</td>
- <td><code>++ it</code></td>
- <td> </td>
- <td><code>I1 &</code></td>
- </tr>
- <tr>
- <td>Postincrement</td>
- <td><code>it ++</code></td>
- <td> </td>
- <td><code>I1</code></td>
- </tr>
- <tr>
- <td>Predecrement</td>
- <td><code>-- it</code></td>
- <td> </td>
- <td><code>I1 &</code></td>
- </tr>
- <tr>
- <td>Postdecrement</td>
- <td><code>it --</code></td>
- <td> </td>
- <td><code>I1</code></td>
- </tr>
- <tr>
- <td>Row Index</td>
- <td><code>it.index1 ()</code></td>
- <td> </td>
- <td><code>C::size_type</code></td>
- </tr>
- <tr>
- <td>Column Index</td>
- <td><code>it.index2 ()</code></td>
- <td> </td>
- <td><code>C::size_type</code></td>
- </tr>
- <tr>
- <td>Row/Column Begin</td>
- <td><code>it.begin ()</code></td>
- <td> </td>
- <td><code>I2</code></td>
- </tr>
- <tr>
- <td>Row/Column End</td>
- <td><code>it.end ()</code></td>
- <td> </td>
- <td><code>I2</code></td>
- </tr>
- <tr>
- <td>Reverse Row/Column Begin</td>
- <td><code>it.rbegin ()</code></td>
- <td> </td>
- <td><code>reverse_iterator<I2></code></td>
- </tr>
- <tr>
- <td>Reverse Row/Column End</td>
- <td><code>it.rend ()</code></td>
- <td> </td>
- <td><code>reverse_iterator<I2></code></td>
- </tr>
- </tbody>
- </table>
- <h4>Expression Semantics</h4>
- <p>Semantics of an expression is defined only where it differs
- from, or is not defined in, Assignable, Equality Comparable and
- Default Constructible.</p>
- <table border="1" summary="semantics">
- <tbody>
- <tr>
- <th>Name</th>
- <th>Expression</th>
- <th>Precondition</th>
- <th>Semantics</th>
- <th>Postcondition</th>
- </tr>
- <tr>
- <td>Default constructor</td>
- <td><code>I1 it</code></td>
- <td> </td>
- <td> </td>
- <td><code>it</code> is singular.</td>
- </tr>
- <tr>
- <td>Dereference</td>
- <td><code>*it</code></td>
- <td><code>it</code> is dereferenceable.</td>
- <td> </td>
- <td> </td>
- </tr>
- <tr>
- <td>Dereference assignment</td>
- <td><code>*it = t</code></td>
- <td>Same as for <code>*it</code>.</td>
- <td> </td>
- <td><code>*it</code> is a copy of t.</td>
- </tr>
- <tr>
- <td>Member access</td>
- <td><code>it->m</code></td>
- <td><code>it</code> is dereferenceable.</td>
- <td>Equivalent to <code>(*it).m</code></td>
- <td> </td>
- </tr>
- <tr>
- <td>Preincrement</td>
- <td><code>++ it</code></td>
- <td><code>it</code> is dereferenceable.</td>
- <td><code>it</code> is modified to point to the next element of
- the column/row, i.e. for column iterators holds<br />
- <code>it.index1 () < (++ it).index1 ()</code> and<br />
- <code>it.index2 () == (++ it).index2 ()</code>,<br />
- for row iterators holds<br />
- <code>it.index1 () == (++ it).index1 ()</code> and<br />
- <code>it.index2 () < (++ it).index2 ()</code>.<br /></td>
- <td><code>it</code> is dereferenceable or past-the-end.
- <code><br />
- &it == &++ it</code>.<br />
- If <code>it1 == it2</code>,<br />
- then <code>++ it1 == ++ it2</code>.</td>
- </tr>
- <tr>
- <td>Postincrement</td>
- <td><code>it ++</code></td>
- <td>Same as for <code>++ it</code>.</td>
- <td>Equivalent to<br />
- <code>{<br />
- I1 itt = it;<br />
- ++ it;<br />
- return itt;<br />
- }</code></td>
- <td><code>it</code> is dereferenceable or past-the-end.</td>
- </tr>
- <tr>
- <td>Predecrement</td>
- <td><code>-- it</code></td>
- <td><code>it</code> is dereferenceable or past-the-end.<br />
- There exists a dereferenceable iterator <code>itt</code> such that
- <code>it == ++ itt</code>.</td>
- <td><code>it</code> is modified to point to the previous
- element of the column/row, i.e. for column iterators holds<br />
- <code>it.index1 () > (-- it).index1 ()</code> and<br />
- <code>it.index2 () == (-- it).index2 ()</code>,<br />
- for row iterators holds<br />
- <code>it.index1 () == (-- it).index1 ()</code> and<br />
- <code>it.index2 () > (-- it).index2 ()</code>.</td>
- <td><code>it</code> is dereferenceable.<br />
- <code>&it = &-- it</code>.<br />
- If <code>it1 == it2</code>,<br />
- then <code>-- it1 == -- it2</code>.</td>
- </tr>
- <tr>
- <td>Postdecrement</td>
- <td><code>it --</code></td>
- <td>Same as for -- <code>it</code>.</td>
- <td>Equivalent to<br />
- <code>{<br />
- I1 itt = it;<br />
- -- it;<br />
- return itt;<br />
- }</code></td>
- <td><code>it</code> is dereferenceable. </td>
- </tr>
- <tr>
- <td>Row Index</td>
- <td><code>it.index1 ()</code></td>
- <td>If <code>it</code> is a Row iterator then <code>it</code> must be dereferenceable.</td>
- <td><code>it.index1 () >= 0</code> and<br />
- <code>it.index1 () < it () .size1 ()</code></td>
- <td>If <code>it1 == it2</code>,<br />
- then <code>it1.index1 () == 12.index1 ()</code>.<br />
- If <code>it1</code>, <code>it2</code> are Row Iterators with <code>it1 == it2</code>,<br />
- then <code>it1.index1 () < (++ it2</code>).<code>index1 ()</code>.<br />
- and <code>it1.index1 () > (-- it2</code>).<code>index1 ()</code>.</td>
- </tr>
- <tr>
- <td>Column Index</td>
- <td><code>it.index2 ()</code></td>
- <td>If <code>it</code> is a Column iterator then <code>it</code> must be dereferenceable.</td>
- <td><code>it.index2 () >= 0</code> and<br />
- <code>it.index2 () < it () .size2 ()</code></td>
- <td>If <code>it1 == it2</code>,<br />
- then <code>it1.index2 () == it2</code>.<code>index2 ()</code>
- .<br />
- If <code>it1</code>, <code>it2</code> are Column Iterators with <code>it1 == i12</code>,<br />
- then <code>it1.index2 () < (++ it2</code>).<code>index2 ()</code>.<br />
- end <code>it1.index2 () > (-- it2</code>).<code>index2 ()</code>.</td>
- </tr>
- <tr>
- <td>Row/Column Begin</td>
- <td><code>it.begin ()</code></td>
- <td><code>it</code> is dereferenceable.</td>
- <td>If <code>it</code> is a Column Iterator,<br />
- then <code>it2 = it.begin ()</code> is a Row Iterator<br />
- with <code>it2.index1 () == it.index1 ()</code>.
- <p>If <code>it</code> is a Row Iterator,<br />
- then <code>it2 = it.begin ()</code> is a Column Iterator<br />
- with <code>it2.index2 () == it.index2 ()</code>.</p>
- </td>
- <td> </td>
- </tr>
- <tr>
- <td>Row/Column End</td>
- <td><code>it.end ()</code></td>
- <td><code>it</code> is dereferenceable.</td>
- <td>If <code>it</code> is a Column Iterator,<br />
- then <code>it2 = it.end ()</code> is a Row Iterator<br />
- with <code>it2.index1 () == it.index1 ()</code>.
- <p>If <code>it</code> is a Row Iterator,<br />
- then <code>it2 = it.end ()</code> is a Column Iterator<br />
- with <code>it2.index2 () == it.index2 ()</code>.</p>
- </td>
- <td> </td>
- </tr>
- <tr>
- <td>Reverse Row/Column Begin</td>
- <td><code>it.rbegin ()</code></td>
- <td><code>it</code> is dereferenceable.</td>
- <td>Equivalent to <code>reverse_iterator<I2> (it.end
- ())</code>.</td>
- <td> </td>
- </tr>
- <tr>
- <td>Reverse Row/Column End</td>
- <td><code>it.rend ()</code></td>
- <td><code>it</code> is dereferenceable.</td>
- <td>Equivalent to <code>reverse_iterator<I2> (it.begin
- ())</code>.</td>
- <td> </td>
- </tr>
- </tbody>
- </table>
- <h4>Complexity guarantees</h4>
- <p>The complexity of operations on indexed bidirectional column/row
- iterators is guaranteed to be logarithmic depending on the size of
- the container. The complexity of one iterator (depending on the
- storage layout) can be lifted to be amortized constant time. The
- complexity of the other iterator (depending on the storage layout
- and the container) can be lifted to be amortized constant time for
- the first row/first column respectively.</p>
- <h4>Invariants</h4>
- <table border="1" summary="invariants">
- <tbody>
- <tr>
- <td>Identity</td>
- <td><code>it1 == it2</code> if and only if <code>&*it1 ==
- &*it2</code>.</td>
- </tr>
- <tr>
- <td>Symmetry of increment and decrement</td>
- <td>If <code>it</code> is dereferenceable, then <code>++ it;
- --it;</code> is a null operation. Similarly, <code>-- it; ++
- it;</code> is a null operation.</td>
- </tr>
- <tr>
- <td>Relation between iterator index and container element
- operator</td>
- <td>If <code>it</code> is dereferenceable, <code>*it == it ()
- (it.index1 (), it.index2 ())</code></td>
- </tr>
- <tr>
- <td>Relation between iterator column/row begin and iterator
- index</td>
- <td>If <code>it</code> is a Column Iterator
- and <code>it2 = it.begin ()</code> then <code>it2.index2 () <
- it2t.index2 ()</code> for all <code>it2t</code> with <code>it2t ()
- == it2 ()</code> and <code>it2t ().index1 () == it2 ().index1
- ()</code>.
- <p>If <code>it</code> is a Row Iterator and
- <code>it2 = it.begin ()</code> then <code>it2.index1 () <
- it2t.index1 ()</code> for all <code>it2t</code> with <code>it2t ()
- == it2 ()</code> and <code>it2t ().index2 () == it2 ().index2
- ()</code>.</p>
- </td>
- </tr>
- <tr>
- <td>Relation between iterator column/row end and iterator
- index</td>
- <td>If <code>it</code> is a Column Iterator
- and <code>it2 = it.end ()</code> then <code>it2.index2 () >
- it2t.index2 ()</code> for all <code>it2t</code> with <code>it2t ()
- == it2 ()</code> and <code>it2t ().index1 () == it2 ().index1
- ()</code>.
- <p>If <code>it</code> is a Row Iterator and
- <code>it2 = it.end ()</code> then <code>it2.index1 () >
- it2t.index1 ()</code> for all <code>it2t</code> with <code>it2t ()
- == it2 ()</code> and <code>it2t ().index2 () == it2 ().index2
- ()</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <h4>Models</h4>
- <ul>
- <li><code>sparse_matrix::iterator1</code></li>
- <li><code>sparse_matrix::iterator2</code></li>
- </ul>
- <h2><a name="indexed_random_access_cr_iterator"
- ></a>Indexed Random Access Column/Row Iterator</h2>
- <h4>Description</h4>
- <p>An Indexed Random Access Column/Row Iterator is an iterator of a
- container that can be dereferenced, incremented, decremented and
- carries index information.</p>
- <h4>Refinement of</h4>
- <p><a href="#indexed_bidirectional_cr_iterator">Indexed
- Bidirectional Column/Row Iterator</a> .</p>
- <h4>Associated types</h4>
- <table border="1" summary="associated types">
- <tbody>
- <tr>
- <td>Value type</td>
- <td>The type of the value obtained by dereferencing a Indexed
- Random Access Column/Row Iterator</td>
- </tr>
- <tr>
- <td>Container type</td>
- <td>The type of the container a Indexed Random Access Column/Row
- Iterator points into.</td>
- </tr>
- </tbody>
- </table>
- <h4>Notation</h4>
- <table border="0" summary="notation">
- <tbody>
- <tr>
- <td><code>I</code></td>
- <td>A type that is a model of Indexed Random Access Column/Row
- Iterator</td>
- </tr>
- <tr>
- <td><code>T</code></td>
- <td>The value type of <code>I</code></td>
- </tr>
- <tr>
- <td><code>C</code></td>
- <td>The container type of <code>I</code></td>
- </tr>
- <tr>
- <td><code>it</code>, <code>itt, it1</code>, <code>it2</code></td>
- <td>Objects of type <code>I</code></td>
- </tr>
- <tr>
- <td><code>t</code></td>
- <td>Object of type <code>T</code></td>
- </tr>
- <tr>
- <td><code>c</code></td>
- <td>Object of type <code>C</code></td>
- </tr>
- </tbody>
- </table>
- <h4>Definitions</h4>
- <h4>Valid expressions</h4>
- <p>In addition to the expressions defined for <a href=
- "#indexed_bidirectional_cr_iterator">Indexed Bidirectional
- Column/Row Iterator</a> , the following expressions must be
- valid.</p>
- <table border="1" summary="expressions">
- <tbody>
- <tr>
- <th>Name</th>
- <th>Expression</th>
- <th>Type requirements</th>
- <th>Return type</th>
- </tr>
- <tr>
- <td>Forward motion</td>
- <td><code>it += n</code></td>
- <td> </td>
- <td><code>I &</code></td>
- </tr>
- <tr>
- <td>Iterator addition</td>
- <td><code>it + n</code></td>
- <td> </td>
- <td><code>I</code></td>
- </tr>
- <tr>
- <td>Backward motion</td>
- <td><code>i -= n</code></td>
- <td> </td>
- <td><code>I &</code></td>
- </tr>
- <tr>
- <td>Iterator subtraction</td>
- <td><code>it - n</code></td>
- <td> </td>
- <td><code>I</code> </td>
- </tr>
- <tr>
- <td>Difference</td>
- <td><code>it1 - it2</code></td>
- <td> </td>
- <td><code>C::difference_type</code></td>
- </tr>
- <tr>
- <td>Element operator</td>
- <td><code>it [n]</code></td>
- <td> </td>
- <td>Convertible to <code>T</code>.</td>
- </tr>
- <tr>
- <td>Element assignment</td>
- <td><code>it [n] = t</code></td>
- <td><code>I</code> is mutable</td>
- <td>Convertible to <code>T</code>.</td>
- </tr>
- </tbody>
- </table>
- <h4>Expression Semantics</h4>
- <p>Semantics of an expression is defined only where it differs
- from, or is not defined in, <a href=
- "#indexed_bidirectional_cr_iterator">Indexed Bidirectional
- Column/Row Iterator</a> .</p>
- <table border="1" summary="semantics">
- <tbody>
- <tr>
- <th>Name</th>
- <th>Expression</th>
- <th>Precondition</th>
- <th>Semantics</th>
- <th>Postcondition</th>
- </tr>
- <tr>
- <td>Forward motion</td>
- <td><code>it += n</code></td>
- <td>Including <code>it</code> itself, there must be <code>n</code>
- dereferenceable or past-the-end iterators following or preceding
- <code>it</code>, depending on whether <code>n</code> is positive or
- negative.</td>
- <td>If <code>n > 0</code>, equivalent to executing <code>++
- it</code> <code>n</code> times. If <code>n < 0</code>,
- equivalent to executing <code>-- it</code> <code>n</code> times. If
- <code>n == 0</code>, this is a null operation.</td>
- <td><code>it</code> is dereferenceable or past-the-end.</td>
- </tr>
- <tr>
- <td>Iterator addition</td>
- <td><code>it + n</code></td>
- <td>Same as for <code>i += n</code>.</td>
- <td>Equivalent to<br />
- <code>{<br />
- I itt = it;<br />
- return itt += n;<br />
- }</code></td>
- <td>Result is dereferenceable or past-the-end.</td>
- </tr>
- <tr>
- <td>Backward motion</td>
- <td><code>it -= n</code></td>
- <td>Including <code>it</code> itself, there must be <code>n</code>
- dereferenceable or past-the-end iterators preceding or following
- <code>it</code>, depending on whether <code>n</code> is positive or
- negative.</td>
- <td>Equivalent to <code>it += (-n)</code>.</td>
- <td><code>it</code> is dereferenceable or past-the-end.</td>
- </tr>
- <tr>
- <td>Iterator subtraction</td>
- <td><code>it - n</code></td>
- <td>Same as for <code>i -= n</code>.</td>
- <td>Equivalent to<br />
- <code>{<br />
- I itt = it;<br />
- return itt -= n;<br />
- }</code></td>
- <td>Result is dereferenceable or past-the-end.</td>
- </tr>
- <tr>
- <td>Difference</td>
- <td><code>it1 - it2</code></td>
- <td>Either <code>it1</code> is reachable from <code>it2</code> or
- <code>it2</code> is reachable from <code>it1</code>, or both.</td>
- <td>Returns a number <code>n</code> such that <code>it1 == it2 +
- n</code></td>
- <td> </td>
- </tr>
- <tr>
- <td>Element operator</td>
- <td><code>it [n]</code></td>
- <td><code>it + n</code> exists and is dereferenceable.</td>
- <td>Equivalent to <code>*(it + n)</code></td>
- <td> </td>
- </tr>
- <tr>
- <td>Element assignment</td>
- <td><code>i[n] = t</code></td>
- <td>Same as for <code>it [n]</code>.</td>
- <td>Equivalent to <code>*(it + n) = t</code></td>
- <td> </td>
- </tr>
- </tbody>
- </table>
- <h4>Complexity guarantees</h4>
- <p>The complexity of operations on indexed random access Column/Row
- iterators is guaranteed to be amortized constant time.</p>
- <h4>Invariants</h4>
- <table border="1" summary="invariants">
- <tbody>
- <tr>
- <td>Symmetry of addition and subtraction</td>
- <td>If <code>it + n</code> is well-defined, then <code>it += n; it
- -= n;</code> and <code>(it + n) - n</code> are null operations.
- Similarly, if <code>it - n</code> is well-defined, then <code>it -=
- n; it += n;</code> and <code>(it - n) + n</code> are null
- operations.</td>
- </tr>
- <tr>
- <td>Relation between distance and addition</td>
- <td>If <code>it1 - it2</code> is well-defined, then <code>it1 ==
- it2 + (it1 - it2)</code>.</td>
- </tr>
- <tr>
- <td>Reachability and distance</td>
- <td>If <code>it1</code> is reachable from <code>it2</code>, then
- <code>it1 - it2 >= 0</code>.</td>
- </tr>
- </tbody>
- </table>
- <h4>Models</h4>
- <ul>
- <li><code>matrix::iterator1</code></li>
- <li><code>matrix::iterator2</code></li>
- </ul>
- <hr />
- <p>Copyright (©) 2000-2002 Joerg Walter, Mathias Koch<br />
- Use, modification and distribution are subject to the
- Boost Software License, Version 1.0.
- (See accompanying file LICENSE_1_0.txt
- or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
- http://www.boost.org/LICENSE_1_0.txt
- </a>).
- </p>
- <script type="text/javascript">
- (function($) {
- $('#toc').toc();
- })(jQuery);
- </script>
- </body>
- </html>
|