forked from boostorg/iterator
Table formatting tweaks for PDF/tex generation.
Some minor editing for language improvements. [SVN r20151]
This commit is contained in:
@ -7,7 +7,7 @@
|
||||
<title>Counting Iterator</title>
|
||||
<meta name="author" content="David Abrahams, Jeremy Siek, Thomas Witt" />
|
||||
<meta name="organization" content="Boost Consulting, Indiana University Open Systems Lab, University of Hanover Institute for Transport Railway Operation and Construction" />
|
||||
<meta name="date" content="2003-08-05" />
|
||||
<meta name="date" content="2003-09-14" />
|
||||
<meta name="copyright" content="Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved" />
|
||||
<link rel="stylesheet" href="../../../rst.css" type="text/css" />
|
||||
</head>
|
||||
@ -27,7 +27,7 @@
|
||||
Lab</a>, University of Hanover <a class="last reference" href="http://www.ive.uni-hannover.de">Institute for Transport
|
||||
Railway Operation and Construction</a></td></tr>
|
||||
<tr><th class="docinfo-name">Date:</th>
|
||||
<td>2003-08-05</td></tr>
|
||||
<td>2003-09-14</td></tr>
|
||||
<tr><th class="docinfo-name">Copyright:</th>
|
||||
<td>Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved</td></tr>
|
||||
</tbody>
|
||||
@ -143,7 +143,7 @@ object copy constructed from <tt class="literal"><span class="pre">x</span></tt>
|
||||
<hr class="footer" />
|
||||
<div class="footer">
|
||||
<a class="reference" href="counting_iterator.rst">View document source</a>.
|
||||
Generated on: 2003-09-14 02:16 UTC.
|
||||
Generated on: 2003-09-21 09:34 UTC.
|
||||
Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
|
||||
</div>
|
||||
</body>
|
||||
|
@ -7,9 +7,200 @@
|
||||
<title>Iterator Facade and Adaptor</title>
|
||||
<meta name="author" content="David Abrahams, Jeremy Siek, Thomas Witt" />
|
||||
<meta name="organization" content="Boost Consulting, Indiana University Open Systems Lab, University of Hanover Institute for Transport Railway Operation and Construction" />
|
||||
<meta name="date" content="2003-08-05" />
|
||||
<meta name="date" content="2003-09-22" />
|
||||
<meta name="copyright" content="Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved" />
|
||||
<link rel="stylesheet" href="../../../rst.css" type="text/css" />
|
||||
<style type="text/css"><!--
|
||||
|
||||
/*
|
||||
:Author: David Goodger
|
||||
:Contact: goodger@users.sourceforge.net
|
||||
:date: $Date$
|
||||
:version: $Revision$
|
||||
:copyright: This stylesheet has been placed in the public domain.
|
||||
|
||||
Default cascading style sheet for the HTML output of Docutils.
|
||||
*/
|
||||
|
||||
.first {
|
||||
margin-top: 0 }
|
||||
|
||||
.last {
|
||||
margin-bottom: 0 }
|
||||
|
||||
a.toc-backref {
|
||||
text-decoration: none ;
|
||||
color: black }
|
||||
|
||||
dd {
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
div.abstract {
|
||||
margin: 2em 5em }
|
||||
|
||||
div.abstract p.topic-title {
|
||||
font-weight: bold ;
|
||||
text-align: center }
|
||||
|
||||
div.attention, div.caution, div.danger, div.error, div.hint,
|
||||
div.important, div.note, div.tip, div.warning {
|
||||
margin: 2em ;
|
||||
border: medium outset ;
|
||||
padding: 1em }
|
||||
|
||||
div.attention p.admonition-title, div.caution p.admonition-title,
|
||||
div.danger p.admonition-title, div.error p.admonition-title,
|
||||
div.warning p.admonition-title {
|
||||
color: red ;
|
||||
font-weight: bold ;
|
||||
font-family: sans-serif }
|
||||
|
||||
div.hint p.admonition-title, div.important p.admonition-title,
|
||||
div.note p.admonition-title, div.tip p.admonition-title {
|
||||
font-weight: bold ;
|
||||
font-family: sans-serif }
|
||||
|
||||
div.dedication {
|
||||
margin: 2em 5em ;
|
||||
text-align: center ;
|
||||
font-style: italic }
|
||||
|
||||
div.dedication p.topic-title {
|
||||
font-weight: bold ;
|
||||
font-style: normal }
|
||||
|
||||
div.figure {
|
||||
margin-left: 2em }
|
||||
|
||||
div.footer, div.header {
|
||||
font-size: smaller }
|
||||
|
||||
div.system-messages {
|
||||
margin: 5em }
|
||||
|
||||
div.system-messages h1 {
|
||||
color: red }
|
||||
|
||||
div.system-message {
|
||||
border: medium outset ;
|
||||
padding: 1em }
|
||||
|
||||
div.system-message p.system-message-title {
|
||||
color: red ;
|
||||
font-weight: bold }
|
||||
|
||||
div.topic {
|
||||
margin: 2em }
|
||||
|
||||
h1.title {
|
||||
text-align: center }
|
||||
|
||||
h2.subtitle {
|
||||
text-align: center }
|
||||
|
||||
hr {
|
||||
width: 75% }
|
||||
|
||||
ol.simple, ul.simple {
|
||||
margin-bottom: 1em }
|
||||
|
||||
ol.arabic {
|
||||
list-style: decimal }
|
||||
|
||||
ol.loweralpha {
|
||||
list-style: lower-alpha }
|
||||
|
||||
ol.upperalpha {
|
||||
list-style: upper-alpha }
|
||||
|
||||
ol.lowerroman {
|
||||
list-style: lower-roman }
|
||||
|
||||
ol.upperroman {
|
||||
list-style: upper-roman }
|
||||
|
||||
p.caption {
|
||||
font-style: italic }
|
||||
|
||||
p.credits {
|
||||
font-style: italic ;
|
||||
font-size: smaller }
|
||||
|
||||
p.label {
|
||||
white-space: nowrap }
|
||||
|
||||
p.topic-title {
|
||||
font-weight: bold }
|
||||
|
||||
pre.address {
|
||||
margin-bottom: 0 ;
|
||||
margin-top: 0 ;
|
||||
font-family: serif ;
|
||||
font-size: 100% }
|
||||
|
||||
pre.line-block {
|
||||
font-family: serif ;
|
||||
font-size: 100% }
|
||||
|
||||
pre.literal-block, pre.doctest-block {
|
||||
margin-left: 2em ;
|
||||
margin-right: 2em ;
|
||||
background-color: #eeeeee }
|
||||
|
||||
span.classifier {
|
||||
font-family: sans-serif ;
|
||||
font-style: oblique }
|
||||
|
||||
span.classifier-delimiter {
|
||||
font-family: sans-serif ;
|
||||
font-weight: bold }
|
||||
|
||||
span.interpreted {
|
||||
font-family: sans-serif }
|
||||
|
||||
span.option-argument {
|
||||
font-style: italic }
|
||||
|
||||
span.pre {
|
||||
white-space: pre }
|
||||
|
||||
span.problematic {
|
||||
color: red }
|
||||
|
||||
table {
|
||||
margin-top: 0.5em ;
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
table.citation {
|
||||
border-left: solid thin gray ;
|
||||
padding-left: 0.5ex }
|
||||
|
||||
table.docinfo {
|
||||
margin: 2em 4em }
|
||||
|
||||
table.footnote {
|
||||
border-left: solid thin black ;
|
||||
padding-left: 0.5ex }
|
||||
|
||||
td, th {
|
||||
padding-left: 0.5em ;
|
||||
padding-right: 0.5em ;
|
||||
vertical-align: top }
|
||||
|
||||
th.docinfo-name, th.field-name {
|
||||
font-weight: bold ;
|
||||
text-align: left ;
|
||||
white-space: nowrap }
|
||||
|
||||
h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt {
|
||||
font-size: 100% }
|
||||
|
||||
tt {
|
||||
background-color: #eeeeee }
|
||||
|
||||
ul.auto-toc {
|
||||
list-style-type: none }
|
||||
|
||||
--></style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="document" id="iterator-facade-and-adaptor">
|
||||
@ -21,13 +212,13 @@
|
||||
<tr><th class="docinfo-name">Author:</th>
|
||||
<td>David Abrahams, Jeremy Siek, Thomas Witt</td></tr>
|
||||
<tr><th class="docinfo-name">Contact:</th>
|
||||
<td><a class="first reference" href="mailto:dave@boost-consulting.com">dave@boost-consulting.com</a>, <a class="reference" href="mailto:jsiek@osl.iu.edu">jsiek@osl.iu.edu</a>, <a class="last reference" href="mailto:witt@ive.uni-hannover.de">witt@ive.uni-hannover.de</a></td></tr>
|
||||
<td><a class="first reference" href="mailto:dave@boost-consulting.com">dave@boost-consulting.com</a>, <a class="reference" href="mailto:jsiek@osl.iu.edu">jsiek@osl.iu.edu</a>, <a class="last reference" href="mailto:witt@acm.org">witt@acm.org</a></td></tr>
|
||||
<tr><th class="docinfo-name">Organization:</th>
|
||||
<td><a class="first reference" href="http://www.boost-consulting.com">Boost Consulting</a>, Indiana University <a class="reference" href="http://www.osl.iu.edu">Open Systems
|
||||
Lab</a>, University of Hanover <a class="last reference" href="http://www.ive.uni-hannover.de">Institute for Transport
|
||||
Railway Operation and Construction</a></td></tr>
|
||||
<tr><th class="docinfo-name">Date:</th>
|
||||
<td>2003-08-05</td></tr>
|
||||
<td>2003-09-22</td></tr>
|
||||
<tr class="field"><th class="docinfo-name">Number:</th><td class="field-body"><strong>This document is a revised version of the official</strong> N1476=03-0059</td>
|
||||
</tr>
|
||||
<tr><th class="docinfo-name">Copyright:</th>
|
||||
@ -965,11 +1156,12 @@ class iterator_adaptor
|
||||
expressions involving <tt class="literal"><span class="pre">m_iterator</span></tt> in the specifications of those
|
||||
private member functions of <tt class="literal"><span class="pre">iterator_adaptor</span></tt> that are not
|
||||
redefined by the <tt class="literal"><span class="pre">Derived</span></tt> class and that are needed to model the
|
||||
concept corresponding to the <tt class="literal"><span class="pre">iterator_adaptor</span></tt>'s <tt class="literal"><span class="pre">category</span></tt>
|
||||
typedef according to the requirements of <tt class="literal"><span class="pre">iterator_facade</span></tt>. The
|
||||
rest of the template parameters specify the types for the member
|
||||
typedefs in <tt class="literal"><span class="pre">iterator_facade</span></tt>. The following pseudo-code
|
||||
specifies the traits types for <tt class="literal"><span class="pre">iterator_adaptor</span></tt>.</p>
|
||||
concept corresponding to
|
||||
<tt class="literal"><span class="pre">iterator_traits<Derived>::iterator_category</span></tt> according to the
|
||||
requirements of <tt class="literal"><span class="pre">iterator_facade</span></tt>. The rest of the template
|
||||
parameters specify the types for the member typedefs in
|
||||
<tt class="literal"><span class="pre">iterator_facade</span></tt>. The following pseudo-code specifies the
|
||||
traits types for <tt class="literal"><span class="pre">iterator_adaptor</span></tt>.</p>
|
||||
<pre class="literal-block">
|
||||
if (Value == use_default)
|
||||
value_type = iterator_traits<Base>::value_type;
|
||||
@ -994,12 +1186,17 @@ if (Category == use_default)
|
||||
access_category< Base >,
|
||||
traversal_category< Base >
|
||||
>
|
||||
else if (Category is an access tag)
|
||||
else if (Category is convertible to a standard access tag)
|
||||
iterator_category = iterator_tag<
|
||||
Category
|
||||
...
|
||||
else if (Category has a nested traversal type)
|
||||
if (reference is not a reference-to-const)
|
||||
Category::access
|
||||
else
|
||||
if (Category
|
||||
|
||||
|
||||
else if (Category is a traversal tag)
|
||||
else if (Category is convertable to a standard traversal tag)
|
||||
...
|
||||
else
|
||||
iterator_category = Category;
|
||||
@ -1369,7 +1566,7 @@ then returns the result.</p>
|
||||
<div class="section" id="class-template-transform-iterator">
|
||||
<h4><a class="toc-backref" href="#id50" name="class-template-transform-iterator">Class template <tt class="literal"><span class="pre">transform_iterator</span></tt></a></h4>
|
||||
<pre class="literal-block">
|
||||
template <class AdaptableUnaryFunction,
|
||||
template <class UnaryFunction,
|
||||
class Iterator,
|
||||
class Reference = use_default,
|
||||
class Value = use_default>
|
||||
@ -1379,45 +1576,44 @@ class transform_iterator
|
||||
friend class iterator_core_access;
|
||||
public:
|
||||
transform_iterator();
|
||||
transform_iterator(Iterator const& x, AdaptableUnaryFunction f);
|
||||
transform_iterator(Iterator const& x, UnaryFunction f);
|
||||
|
||||
template<class OtherIterator, class R2, class V2>
|
||||
transform_iterator(
|
||||
transform_iterator<AdaptableUnaryFunction, OtherIterator, R2, V2> const& t
|
||||
transform_iterator<UnaryFunction, OtherIterator, R2, V2> const& t
|
||||
, typename enable_if_convertible<OtherIterator, Iterator>::type* = 0 // exposition
|
||||
);
|
||||
|
||||
AdaptableUnaryFunction functor() const;
|
||||
UnaryFunction functor() const;
|
||||
private:
|
||||
typename transform_iterator::value_type dereference() const;
|
||||
AdaptableUnaryFunction m_f;
|
||||
UnaryFunction m_f;
|
||||
};
|
||||
</pre>
|
||||
</div>
|
||||
<div class="section" id="transform-iterator-requirements">
|
||||
<h4><a class="toc-backref" href="#id51" name="transform-iterator-requirements"><tt class="literal"><span class="pre">transform_iterator</span></tt> requirements</a></h4>
|
||||
<p>The type <tt class="literal"><span class="pre">AdaptableUnaryFunction</span></tt> must be Assignable, Copy
|
||||
Constructible, and the expression <tt class="literal"><span class="pre">f(x)</span></tt> must be valid where <tt class="literal"><span class="pre">f</span></tt>
|
||||
is an object of type <tt class="literal"><span class="pre">AdaptableUnaryFunction</span></tt>, <tt class="literal"><span class="pre">x</span></tt> is an object of
|
||||
type <tt class="literal"><span class="pre">AdaptableUnaryFunction::argument_type</span></tt>, and where the type of
|
||||
<tt class="literal"><span class="pre">f(x)</span></tt> must be <tt class="literal"><span class="pre">AdaptableUnaryFunction::result_type</span></tt>.</p>
|
||||
<p>The type <tt class="literal"><span class="pre">UnaryFunction</span></tt> must be Assignable, Copy Constructible, and
|
||||
the expression <tt class="literal"><span class="pre">f(*i)</span></tt> must be valid where <tt class="literal"><span class="pre">f</span></tt> is an object of
|
||||
type <tt class="literal"><span class="pre">UnaryFunction</span></tt>, <tt class="literal"><span class="pre">i</span></tt> is an object of type <tt class="literal"><span class="pre">Iterator</span></tt>, and
|
||||
where the type of <tt class="literal"><span class="pre">f(*i)</span></tt> must be
|
||||
<tt class="literal"><span class="pre">result_of<UnaryFunction(iterator_traits<Iterator>::reference)>::type</span></tt>.</p>
|
||||
<p>The type <tt class="literal"><span class="pre">Iterator</span></tt> must at least model Readable Iterator. The
|
||||
resulting <tt class="literal"><span class="pre">transform_iterator</span></tt> models the most refined of the
|
||||
following options that is also modeled by <tt class="literal"><span class="pre">Iterator</span></tt>.</p>
|
||||
<blockquote>
|
||||
<ul class="simple">
|
||||
<li>Writable Lvalue Iterator if the <tt class="literal"><span class="pre">result_type</span></tt> of the
|
||||
<tt class="literal"><span class="pre">AdaptableUnaryFunction</span></tt> is a non-const reference.</li>
|
||||
<li>Readable Lvalue Iterator if the <tt class="literal"><span class="pre">result_type</span></tt> is a const
|
||||
<li>Writable Lvalue Iterator if <tt class="literal"><span class="pre">result_of<UnaryFunction(iterator_traits<Iterator>::reference)>::type</span></tt> is a non-const reference.</li>
|
||||
<li>Readable Lvalue Iterator if <tt class="literal"><span class="pre">result_of<UnaryFunction(iterator_traits<Iterator>::reference)>::type</span></tt> is a const
|
||||
reference.</li>
|
||||
<li>Readable Iterator otherwise.</li>
|
||||
</ul>
|
||||
</blockquote>
|
||||
<p>The <tt class="literal"><span class="pre">transform_iterator</span></tt> models the most refined standard traversal
|
||||
concept that is modeled by <tt class="literal"><span class="pre">Iterator</span></tt>.</p>
|
||||
<p>The <tt class="literal"><span class="pre">value_type</span></tt> of <tt class="literal"><span class="pre">transform_iterator</span></tt> is
|
||||
<tt class="literal"><span class="pre">remove_reference<result_type>::type</span></tt>. The <tt class="literal"><span class="pre">reference</span></tt> type is
|
||||
<tt class="literal"><span class="pre">result_type</span></tt>.</p>
|
||||
<p>The <tt class="literal"><span class="pre">reference</span></tt> type of <tt class="literal"><span class="pre">transform_iterator</span></tt> is
|
||||
<tt class="literal"><span class="pre">result_of<UnaryFunction(iterator_traits<Iterator>::reference)>::type</span></tt>.
|
||||
The <tt class="literal"><span class="pre">value_type</span></tt> is <tt class="literal"><span class="pre">remove_cv<remove_reference<reference></span> <span class="pre">>::type</span></tt>.</p>
|
||||
</div>
|
||||
<div class="section" id="transform-iterator-public-operations">
|
||||
<h4><a class="toc-backref" href="#id52" name="transform-iterator-public-operations"><tt class="literal"><span class="pre">transform_iterator</span></tt> public operations</a></h4>
|
||||
@ -1431,7 +1627,7 @@ and <tt class="literal"><span class="pre">m_iterator</span></tt> default constru
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><tt class="literal"><span class="pre">transform_iterator(Iterator</span> <span class="pre">const&</span> <span class="pre">x,</span> <span class="pre">AdaptableUnaryFunction</span> <span class="pre">f);</span></tt></p>
|
||||
<p><tt class="literal"><span class="pre">transform_iterator(Iterator</span> <span class="pre">const&</span> <span class="pre">x,</span> <span class="pre">UnaryFunction</span> <span class="pre">f);</span></tt></p>
|
||||
<table class="field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
@ -1444,7 +1640,7 @@ initialized to <tt class="literal"><span class="pre">f</span></tt> and <tt class
|
||||
<pre class="literal-block">
|
||||
template<class OtherIterator, class R2, class V2>
|
||||
transform_iterator(
|
||||
transform_iterator<AdaptableUnaryFunction, OtherIterator, R2, V2> const& t
|
||||
transform_iterator<UnaryFunction, OtherIterator, R2, V2> const& t
|
||||
, typename enable_if_convertible<OtherIterator, Iterator>::type* = 0 // exposition
|
||||
);
|
||||
</pre>
|
||||
@ -1458,7 +1654,7 @@ transform_iterator(
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><tt class="literal"><span class="pre">AdaptableUnaryFunction</span> <span class="pre">functor()</span> <span class="pre">const;</span></tt></p>
|
||||
<p><tt class="literal"><span class="pre">UnaryFunction</span> <span class="pre">functor()</span> <span class="pre">const;</span></tt></p>
|
||||
<table class="field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
@ -1847,7 +2043,7 @@ LocalWords: OtherIncrementable Coplien -->
|
||||
<hr class="footer" />
|
||||
<div class="footer">
|
||||
<a class="reference" href="facade-and-adaptor.rst">View document source</a>.
|
||||
Generated on: 2003-09-14 02:16 UTC.
|
||||
Generated on: 2003-09-22 14:17 UTC.
|
||||
Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
|
||||
</div>
|
||||
</body>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<title>Filter Iterator</title>
|
||||
<meta name="author" content="David Abrahams, Jeremy Siek, Thomas Witt" />
|
||||
<meta name="organization" content="Boost Consulting, Indiana University Open Systems Lab, University of Hanover Institute for Transport Railway Operation and Construction" />
|
||||
<meta name="date" content="2003-08-05" />
|
||||
<meta name="date" content="2003-09-14" />
|
||||
<meta name="copyright" content="Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved" />
|
||||
<link rel="stylesheet" href="../../../rst.css" type="text/css" />
|
||||
</head>
|
||||
@ -27,7 +27,7 @@
|
||||
Lab</a>, University of Hanover <a class="last reference" href="http://www.ive.uni-hannover.de">Institute for Transport
|
||||
Railway Operation and Construction</a></td></tr>
|
||||
<tr><th class="docinfo-name">Date:</th>
|
||||
<td>2003-08-05</td></tr>
|
||||
<td>2003-09-14</td></tr>
|
||||
<tr><th class="docinfo-name">Copyright:</th>
|
||||
<td>Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved</td></tr>
|
||||
</tbody>
|
||||
@ -189,7 +189,7 @@ filter_iterator(
|
||||
<hr class="footer" />
|
||||
<div class="footer">
|
||||
<a class="reference" href="filter_iterator.rst">View document source</a>.
|
||||
Generated on: 2003-09-14 02:16 UTC.
|
||||
Generated on: 2003-09-21 09:34 UTC.
|
||||
Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
|
||||
</div>
|
||||
</body>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<title>Function Output Iterator</title>
|
||||
<meta name="author" content="David Abrahams, Jeremy Siek, Thomas Witt" />
|
||||
<meta name="organization" content="Boost Consulting, Indiana University Open Systems Lab, University of Hanover Institute for Transport Railway Operation and Construction" />
|
||||
<meta name="date" content="2003-08-05" />
|
||||
<meta name="date" content="2003-09-14" />
|
||||
<meta name="copyright" content="Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved" />
|
||||
<link rel="stylesheet" href="../../../rst.css" type="text/css" />
|
||||
</head>
|
||||
@ -27,7 +27,7 @@
|
||||
Lab</a>, University of Hanover <a class="last reference" href="http://www.ive.uni-hannover.de">Institute for Transport
|
||||
Railway Operation and Construction</a></td></tr>
|
||||
<tr><th class="docinfo-name">Date:</th>
|
||||
<td>2003-08-05</td></tr>
|
||||
<td>2003-09-14</td></tr>
|
||||
<tr><th class="docinfo-name">Copyright:</th>
|
||||
<td>Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved</td></tr>
|
||||
</tbody>
|
||||
@ -158,7 +158,7 @@ return *this;
|
||||
<hr class="footer" />
|
||||
<div class="footer">
|
||||
<a class="reference" href="function_output_iterator.rst">View document source</a>.
|
||||
Generated on: 2003-09-14 02:16 UTC.
|
||||
Generated on: 2003-09-21 09:34 UTC.
|
||||
Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
|
||||
</div>
|
||||
</body>
|
||||
|
@ -181,7 +181,7 @@ LocalWords: TraversalTag typename lvalues DWA Hmm JGS -->
|
||||
<hr class="footer" />
|
||||
<div class="footer">
|
||||
<a class="reference" href="index.rst">View document source</a>.
|
||||
Generated on: 2003-09-14 02:16 UTC.
|
||||
Generated on: 2003-09-21 09:34 UTC.
|
||||
Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
|
||||
</div>
|
||||
</body>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<title>Indirect Iterator</title>
|
||||
<meta name="author" content="David Abrahams, Jeremy Siek, Thomas Witt" />
|
||||
<meta name="organization" content="Boost Consulting, Indiana University Open Systems Lab, University of Hanover Institute for Transport Railway Operation and Construction" />
|
||||
<meta name="date" content="2003-08-05" />
|
||||
<meta name="date" content="2003-09-14" />
|
||||
<meta name="copyright" content="Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved" />
|
||||
<link rel="stylesheet" href="../../../rst.css" type="text/css" />
|
||||
</head>
|
||||
@ -27,7 +27,7 @@
|
||||
Lab</a>, University of Hanover <a class="last reference" href="http://www.ive.uni-hannover.de">Institute for Transport
|
||||
Railway Operation and Construction</a></td></tr>
|
||||
<tr><th class="docinfo-name">Date:</th>
|
||||
<td>2003-08-05</td></tr>
|
||||
<td>2003-09-14</td></tr>
|
||||
<tr><th class="docinfo-name">Copyright:</th>
|
||||
<td>Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved</td></tr>
|
||||
</tbody>
|
||||
@ -162,7 +162,7 @@ indirect_iterator(
|
||||
<hr class="footer" />
|
||||
<div class="footer">
|
||||
<a class="reference" href="indirect_iterator.rst">View document source</a>.
|
||||
Generated on: 2003-09-14 02:16 UTC.
|
||||
Generated on: 2003-09-21 09:34 UTC.
|
||||
Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
|
||||
</div>
|
||||
</body>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<title>Iterator Adaptor</title>
|
||||
<meta name="author" content="David Abrahams, Jeremy Siek, Thomas Witt" />
|
||||
<meta name="organization" content="Boost Consulting, Indiana University Open Systems Lab, University of Hanover Institute for Transport Railway Operation and Construction" />
|
||||
<meta name="date" content="2003-08-05" />
|
||||
<meta name="date" content="2003-09-14" />
|
||||
<meta name="copyright" content="Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved" />
|
||||
<link rel="stylesheet" href="../../../rst.css" type="text/css" />
|
||||
</head>
|
||||
@ -27,7 +27,7 @@
|
||||
Lab</a>, University of Hanover <a class="last reference" href="http://www.ive.uni-hannover.de">Institute for Transport
|
||||
Railway Operation and Construction</a></td></tr>
|
||||
<tr><th class="docinfo-name">Date:</th>
|
||||
<td>2003-08-05</td></tr>
|
||||
<td>2003-09-14</td></tr>
|
||||
<tr><th class="docinfo-name">Copyright:</th>
|
||||
<td>Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved</td></tr>
|
||||
</tbody>
|
||||
@ -328,7 +328,7 @@ typename iterator_adaptor::difference_type distance_to(
|
||||
<hr class="footer" />
|
||||
<div class="footer">
|
||||
<a class="reference" href="iterator_adaptor.rst">View document source</a>.
|
||||
Generated on: 2003-09-14 02:16 UTC.
|
||||
Generated on: 2003-09-21 09:34 UTC.
|
||||
Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
|
||||
</div>
|
||||
</body>
|
||||
|
@ -51,11 +51,12 @@ The ``Derived`` template parameter must be a derived class of
|
||||
expressions involving ``m_iterator`` in the specifications of those
|
||||
private member functions of ``iterator_adaptor`` that are not
|
||||
redefined by the ``Derived`` class and that are needed to model the
|
||||
concept corresponding to the ``iterator_adaptor``\ 's ``category``
|
||||
typedef according to the requirements of ``iterator_facade``. The
|
||||
rest of the template parameters specify the types for the member
|
||||
typedefs in ``iterator_facade``. The following pseudo-code
|
||||
specifies the traits types for ``iterator_adaptor``.
|
||||
concept corresponding to
|
||||
``iterator_traits<Derived>::iterator_category`` according to the
|
||||
requirements of ``iterator_facade``. The rest of the template
|
||||
parameters specify the types for the member typedefs in
|
||||
``iterator_facade``. The following pseudo-code specifies the
|
||||
traits types for ``iterator_adaptor``.
|
||||
|
||||
::
|
||||
|
||||
@ -82,12 +83,17 @@ specifies the traits types for ``iterator_adaptor``.
|
||||
access_category< Base >,
|
||||
traversal_category< Base >
|
||||
>
|
||||
else if (Category is an access tag)
|
||||
else if (Category is convertible to a standard access tag)
|
||||
iterator_category = iterator_tag<
|
||||
Category
|
||||
...
|
||||
else if (Category has a nested traversal type)
|
||||
if (reference is not a reference-to-const)
|
||||
Category::access
|
||||
else
|
||||
if (Category
|
||||
|
||||
|
||||
else if (Category is a traversal tag)
|
||||
else if (Category is convertable to a standard traversal tag)
|
||||
...
|
||||
else
|
||||
iterator_category = Category;
|
||||
|
@ -7,7 +7,7 @@
|
||||
<title>Iterator Facade</title>
|
||||
<meta name="author" content="David Abrahams, Jeremy Siek, Thomas Witt" />
|
||||
<meta name="organization" content="Boost Consulting, Indiana University Open Systems Lab, University of Hanover Institute for Transport Railway Operation and Construction" />
|
||||
<meta name="date" content="2003-08-05" />
|
||||
<meta name="date" content="2003-09-14" />
|
||||
<meta name="copyright" content="Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved" />
|
||||
<link rel="stylesheet" href="../../../rst.css" type="text/css" />
|
||||
</head>
|
||||
@ -27,7 +27,7 @@
|
||||
Lab</a>, University of Hanover <a class="last reference" href="http://www.ive.uni-hannover.de">Institute for Transport
|
||||
Railway Operation and Construction</a></td></tr>
|
||||
<tr><th class="docinfo-name">Date:</th>
|
||||
<td>2003-08-05</td></tr>
|
||||
<td>2003-09-14</td></tr>
|
||||
<tr><th class="docinfo-name">Copyright:</th>
|
||||
<td>Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved</td></tr>
|
||||
</tbody>
|
||||
@ -573,7 +573,7 @@ return tmp -= n;</td>
|
||||
<hr class="footer" />
|
||||
<div class="footer">
|
||||
<a class="reference" href="iterator_facade.rst">View document source</a>.
|
||||
Generated on: 2003-09-14 02:16 UTC.
|
||||
Generated on: 2003-09-21 09:34 UTC.
|
||||
Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
|
||||
</div>
|
||||
</body>
|
||||
|
@ -3,13 +3,204 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="Docutils 0.3.0: http://docutils.sourceforge.net/" />
|
||||
<meta name="generator" content="Docutils 0.3.1: http://docutils.sourceforge.net/" />
|
||||
<title>New Iterator Concepts</title>
|
||||
<meta name="author" content="David Abrahams, Jeremy Siek, Thomas Witt" />
|
||||
<meta name="organization" content="Boost Consulting, Indiana University Open Systems Lab, University of Hanover Institute for Transport Railway Operation and Construction" />
|
||||
<meta name="date" content="2003-09-22" />
|
||||
<meta name="copyright" content="Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved" />
|
||||
<link rel="stylesheet" href="default.css" type="text/css" />
|
||||
<style type="text/css"><!--
|
||||
|
||||
/*
|
||||
:Author: David Goodger
|
||||
:Contact: goodger@users.sourceforge.net
|
||||
:date: $Date$
|
||||
:version: $Revision$
|
||||
:copyright: This stylesheet has been placed in the public domain.
|
||||
|
||||
Default cascading style sheet for the HTML output of Docutils.
|
||||
*/
|
||||
|
||||
.first {
|
||||
margin-top: 0 }
|
||||
|
||||
.last {
|
||||
margin-bottom: 0 }
|
||||
|
||||
a.toc-backref {
|
||||
text-decoration: none ;
|
||||
color: black }
|
||||
|
||||
dd {
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
div.abstract {
|
||||
margin: 2em 5em }
|
||||
|
||||
div.abstract p.topic-title {
|
||||
font-weight: bold ;
|
||||
text-align: center }
|
||||
|
||||
div.attention, div.caution, div.danger, div.error, div.hint,
|
||||
div.important, div.note, div.tip, div.warning {
|
||||
margin: 2em ;
|
||||
border: medium outset ;
|
||||
padding: 1em }
|
||||
|
||||
div.attention p.admonition-title, div.caution p.admonition-title,
|
||||
div.danger p.admonition-title, div.error p.admonition-title,
|
||||
div.warning p.admonition-title {
|
||||
color: red ;
|
||||
font-weight: bold ;
|
||||
font-family: sans-serif }
|
||||
|
||||
div.hint p.admonition-title, div.important p.admonition-title,
|
||||
div.note p.admonition-title, div.tip p.admonition-title {
|
||||
font-weight: bold ;
|
||||
font-family: sans-serif }
|
||||
|
||||
div.dedication {
|
||||
margin: 2em 5em ;
|
||||
text-align: center ;
|
||||
font-style: italic }
|
||||
|
||||
div.dedication p.topic-title {
|
||||
font-weight: bold ;
|
||||
font-style: normal }
|
||||
|
||||
div.figure {
|
||||
margin-left: 2em }
|
||||
|
||||
div.footer, div.header {
|
||||
font-size: smaller }
|
||||
|
||||
div.system-messages {
|
||||
margin: 5em }
|
||||
|
||||
div.system-messages h1 {
|
||||
color: red }
|
||||
|
||||
div.system-message {
|
||||
border: medium outset ;
|
||||
padding: 1em }
|
||||
|
||||
div.system-message p.system-message-title {
|
||||
color: red ;
|
||||
font-weight: bold }
|
||||
|
||||
div.topic {
|
||||
margin: 2em }
|
||||
|
||||
h1.title {
|
||||
text-align: center }
|
||||
|
||||
h2.subtitle {
|
||||
text-align: center }
|
||||
|
||||
hr {
|
||||
width: 75% }
|
||||
|
||||
ol.simple, ul.simple {
|
||||
margin-bottom: 1em }
|
||||
|
||||
ol.arabic {
|
||||
list-style: decimal }
|
||||
|
||||
ol.loweralpha {
|
||||
list-style: lower-alpha }
|
||||
|
||||
ol.upperalpha {
|
||||
list-style: upper-alpha }
|
||||
|
||||
ol.lowerroman {
|
||||
list-style: lower-roman }
|
||||
|
||||
ol.upperroman {
|
||||
list-style: upper-roman }
|
||||
|
||||
p.caption {
|
||||
font-style: italic }
|
||||
|
||||
p.credits {
|
||||
font-style: italic ;
|
||||
font-size: smaller }
|
||||
|
||||
p.label {
|
||||
white-space: nowrap }
|
||||
|
||||
p.topic-title {
|
||||
font-weight: bold }
|
||||
|
||||
pre.address {
|
||||
margin-bottom: 0 ;
|
||||
margin-top: 0 ;
|
||||
font-family: serif ;
|
||||
font-size: 100% }
|
||||
|
||||
pre.line-block {
|
||||
font-family: serif ;
|
||||
font-size: 100% }
|
||||
|
||||
pre.literal-block, pre.doctest-block {
|
||||
margin-left: 2em ;
|
||||
margin-right: 2em ;
|
||||
background-color: #eeeeee }
|
||||
|
||||
span.classifier {
|
||||
font-family: sans-serif ;
|
||||
font-style: oblique }
|
||||
|
||||
span.classifier-delimiter {
|
||||
font-family: sans-serif ;
|
||||
font-weight: bold }
|
||||
|
||||
span.interpreted {
|
||||
font-family: sans-serif }
|
||||
|
||||
span.option-argument {
|
||||
font-style: italic }
|
||||
|
||||
span.pre {
|
||||
white-space: pre }
|
||||
|
||||
span.problematic {
|
||||
color: red }
|
||||
|
||||
table {
|
||||
margin-top: 0.5em ;
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
table.citation {
|
||||
border-left: solid thin gray ;
|
||||
padding-left: 0.5ex }
|
||||
|
||||
table.docinfo {
|
||||
margin: 2em 4em }
|
||||
|
||||
table.footnote {
|
||||
border-left: solid thin black ;
|
||||
padding-left: 0.5ex }
|
||||
|
||||
td, th {
|
||||
padding-left: 0.5em ;
|
||||
padding-right: 0.5em ;
|
||||
vertical-align: top }
|
||||
|
||||
th.docinfo-name, th.field-name {
|
||||
font-weight: bold ;
|
||||
text-align: left ;
|
||||
white-space: nowrap }
|
||||
|
||||
h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt {
|
||||
font-size: 100% }
|
||||
|
||||
tt {
|
||||
background-color: #eeeeee }
|
||||
|
||||
ul.auto-toc {
|
||||
list-style-type: none }
|
||||
|
||||
--></style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="document" id="new-iterator-concepts">
|
||||
@ -21,7 +212,7 @@
|
||||
<tr><th class="docinfo-name">Author:</th>
|
||||
<td>David Abrahams, Jeremy Siek, Thomas Witt</td></tr>
|
||||
<tr><th class="docinfo-name">Contact:</th>
|
||||
<td><a class="first reference" href="mailto:dave@boost-consulting.com">dave@boost-consulting.com</a>, <a class="reference" href="mailto:jsiek@osl.iu.edu">jsiek@osl.iu.edu</a>, <a class="last reference" href="mailto:witt@ive.uni-hannover.de">witt@ive.uni-hannover.de</a></td></tr>
|
||||
<td><a class="first reference" href="mailto:dave@boost-consulting.com">dave@boost-consulting.com</a>, <a class="reference" href="mailto:jsiek@osl.iu.edu">jsiek@osl.iu.edu</a>, <a class="last reference" href="mailto:witt@acm.org">witt@acm.org</a></td></tr>
|
||||
<tr><th class="docinfo-name">Organization:</th>
|
||||
<td><a class="first reference" href="http://www.boost-consulting.com">Boost Consulting</a>, Indiana University <a class="reference" href="http://www.osl.iu.edu">Open Systems Lab</a>, University of Hanover <a class="last reference" href="http://www.ive.uni-hannover.de">Institute for Transport Railway Operation and Construction</a></td></tr>
|
||||
<tr><th class="docinfo-name">Date:</th>
|
||||
@ -96,6 +287,10 @@ requirements in the iterator categories.</p>
|
||||
<col width="31%" />
|
||||
<col width="69%" />
|
||||
</colgroup>
|
||||
<thead valign="bottom">
|
||||
<tr><th colspan="2">Value Access Requirements in Existing Iterator Categories</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody valign="top">
|
||||
<tr><td>Output Iterator</td>
|
||||
<td><tt class="literal"><span class="pre">*i</span> <span class="pre">=</span> <span class="pre">a</span></tt></td>
|
||||
@ -176,7 +371,9 @@ following lists the proposed changes to the type requirements of
|
||||
algorithms.</p>
|
||||
<p>Forward Iterator -> Forward Traversal Iterator and Readable Iterator</p>
|
||||
<blockquote>
|
||||
<tt class="literal"><span class="pre">find_end,</span> <span class="pre">adjacent_find,</span> <span class="pre">search,</span> <span class="pre">search_n,</span> <span class="pre">rotate_copy,</span> <span class="pre">lower_bound,</span> <span class="pre">upper_bound,</span> <span class="pre">equal_range,</span> <span class="pre">binary_search,</span> <span class="pre">min_element,</span> <span class="pre">max_element</span></tt></blockquote>
|
||||
<tt class="literal"><span class="pre">find_end,</span> <span class="pre">adjacent_find,</span> <span class="pre">search,</span> <span class="pre">search_n,</span> <span class="pre">rotate_copy,</span>
|
||||
<span class="pre">lower_bound,</span> <span class="pre">upper_bound,</span> <span class="pre">equal_range,</span> <span class="pre">binary_search,</span>
|
||||
<span class="pre">min_element,</span> <span class="pre">max_element</span></tt></blockquote>
|
||||
<p>Forward Iterator (1) -> Single Pass Iterator and Readable Iterator
|
||||
Forward Iterator (2) -> Forward Traversal Iterator and Readable Iterator</p>
|
||||
<blockquote>
|
||||
@ -229,7 +426,7 @@ Bidirectional Iterator (2) -> Bidirectional Traversal Iterator and Writable I
|
||||
</div>
|
||||
<div class="section" id="design">
|
||||
<h1><a class="toc-backref" href="#id3" name="design">Design</a></h1>
|
||||
<p>The iterator requirements are be separated into two hierarchies. One
|
||||
<p>The iterator requirements are to be separated into two hierarchies. One
|
||||
set of concepts handles the syntax and semantics of value access:</p>
|
||||
<ul class="simple">
|
||||
<li>Readable Iterator</li>
|
||||
@ -260,7 +457,7 @@ matches with the original input and output iterator requirements.</p>
|
||||
<p>The relationship between the new iterator concepts and the old are
|
||||
given in the following diagram.</p>
|
||||
<p><img alt="oldeqnew.png" src="oldeqnew.png" /></p>
|
||||
<p>Like the old iterator requirements, we provide tags for purposes of
|
||||
<p>As in the existing library, we provide tags for purposes of
|
||||
dispatching. There are two hierarchies of tags, one for the access
|
||||
concepts and one for the traversal concepts. The tags are related via
|
||||
inheritance so that a tag is convertible to another tag if the concept
|
||||
@ -270,7 +467,7 @@ whether an iterator is an Lvalue Iterator by checking whether
|
||||
<tt class="literal"><span class="pre">iterator_traits<Iterator>::reference</span></tt> is a real reference.</p>
|
||||
<p>We provide an access mechanism for mapping iterator types to the new
|
||||
tags. Our design reuses <tt class="literal"><span class="pre">iterator_traits<Iter>::iterator_category</span></tt>
|
||||
as the access mechanism. To enable this, a pair of access and
|
||||
as the access mechanism. To that end, a pair of access and
|
||||
traversal tags are combined into a single type using the following
|
||||
<cite>iterator_tag</cite> class.</p>
|
||||
<pre class="literal-block">
|
||||
@ -327,25 +524,25 @@ object of type <tt class="literal"><span class="pre">T</span></tt>.</p>
|
||||
for the value type <tt class="literal"><span class="pre">T</span></tt> if the following expressions are valid and
|
||||
respect the stated semantics. <tt class="literal"><span class="pre">U</span></tt> is the type of any specified
|
||||
member of type <tt class="literal"><span class="pre">T</span></tt>.</p>
|
||||
<blockquote>
|
||||
<table border class="table">
|
||||
<colgroup>
|
||||
<col width="34%" />
|
||||
<col width="30%" />
|
||||
<col width="36%" />
|
||||
<col width="37%" />
|
||||
<col width="37%" />
|
||||
<col width="26%" />
|
||||
</colgroup>
|
||||
<thead valign="bottom">
|
||||
<tr><th colspan="3">Readable Iterator Requirements (in addition to CopyConstructible)</th>
|
||||
</tr>
|
||||
<tr><th>Expression</th>
|
||||
<th>Return Type</th>
|
||||
<th>Assertion/Note/Precondition/Postcondition</th>
|
||||
<th>Note/Precondition</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody valign="top">
|
||||
<tr><td><tt class="literal"><span class="pre">iterator_traits<X>::value_type</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">T</span></tt></td>
|
||||
<td>Any non-reference, non-cv-qualified type</td>
|
||||
<td>Any non-reference,
|
||||
non-cv-qualified type</td>
|
||||
</tr>
|
||||
<tr><td><tt class="literal"><span class="pre">iterator_traits<X>::reference</span></tt></td>
|
||||
<td>Convertible to
|
||||
@ -353,22 +550,24 @@ member of type <tt class="literal"><span class="pre">T</span></tt>.</p>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr><td><tt class="literal"><span class="pre">is_readable<X>::type</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">truetype</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">true_type</span></tt></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr><td><tt class="literal"><span class="pre">*a</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">iterator_traits<X>::reference</span></tt></td>
|
||||
<td>pre: <tt class="literal"><span class="pre">a</span></tt> is dereferenceable. If <tt class="literal"><span class="pre">a</span> <span class="pre">==</span>
|
||||
<span class="pre">b</span></tt> then <tt class="literal"><span class="pre">*a</span></tt> is equivalent to <tt class="literal"><span class="pre">*b</span></tt></td>
|
||||
<td>pre: <tt class="literal"><span class="pre">a</span></tt> is
|
||||
dereferenceable. If <tt class="literal"><span class="pre">a</span>
|
||||
<span class="pre">==</span> <span class="pre">b</span></tt> then <tt class="literal"><span class="pre">*a</span></tt> is
|
||||
equivalent to <tt class="literal"><span class="pre">*b</span></tt></td>
|
||||
</tr>
|
||||
<tr><td><tt class="literal"><span class="pre">a->m</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">U&</span></tt></td>
|
||||
<td>pre: <tt class="literal"><span class="pre">(*a).m</span></tt> is well-defined.
|
||||
Equivalent to <tt class="literal"><span class="pre">(*a).m</span></tt></td>
|
||||
<td>pre: <tt class="literal"><span class="pre">(*a).m</span></tt> is
|
||||
well-defined. Equivalent
|
||||
to <tt class="literal"><span class="pre">(*a).m</span></tt></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</blockquote>
|
||||
<a class="target" id="writable-iterator" name="writable-iterator"></a></div>
|
||||
<div class="section" id="writable-iterators-lib-writable-iterators">
|
||||
<h4><a class="toc-backref" href="#id8" name="writable-iterators-lib-writable-iterators">Writable Iterators [lib.writable.iterators]</a></h4>
|
||||
@ -377,12 +576,11 @@ if the following expressions are valid and respect the stated
|
||||
semantics. In addition, a model of <em>Writable Iterator</em> must include
|
||||
in its documentation the <em>set of value types</em> that it allows for
|
||||
output.</p>
|
||||
<blockquote>
|
||||
<table border class="table">
|
||||
<colgroup>
|
||||
<col width="37%" />
|
||||
<col width="21%" />
|
||||
<col width="42%" />
|
||||
<col width="27%" />
|
||||
<col width="31%" />
|
||||
</colgroup>
|
||||
<thead valign="bottom">
|
||||
<tr><th colspan="3">Writable Iterator Requirements (in addition to CopyConstructible)</th>
|
||||
@ -405,19 +603,17 @@ value types of <tt class="literal"><span class="pre">X</span></tt></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</blockquote>
|
||||
</div>
|
||||
<div class="section" id="swappable-iterators-lib-swappable-iterators">
|
||||
<h4><a class="toc-backref" href="#id9" name="swappable-iterators-lib-swappable-iterators">Swappable Iterators [lib.swappable.iterators]</a></h4>
|
||||
<p>A class or built-in type <tt class="literal"><span class="pre">X</span></tt> models the <em>Swappable Iterator</em> concept
|
||||
if the following expressions are valid and respect the stated
|
||||
semantics.</p>
|
||||
<blockquote>
|
||||
<table border class="table">
|
||||
<colgroup>
|
||||
<col width="38%" />
|
||||
<col width="14%" />
|
||||
<col width="48%" />
|
||||
<col width="37%" />
|
||||
<col width="19%" />
|
||||
<col width="43%" />
|
||||
</colgroup>
|
||||
<thead valign="bottom">
|
||||
<tr><th colspan="3">Swappable Iterator Requirements (in addition to CopyConstructible)</th>
|
||||
@ -434,11 +630,11 @@ semantics.</p>
|
||||
</tr>
|
||||
<tr><td><tt class="literal"><span class="pre">iter_swap(a,</span> <span class="pre">b)</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">void</span></tt></td>
|
||||
<td>post: the pointed to values are exchanged</td>
|
||||
<td>the pointed to values are
|
||||
exchanged</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</blockquote>
|
||||
<dl>
|
||||
<dt>[<em>Note:</em> An iterator that is a model of the <em>Readable</em> and <em>Writable Iterator</em> concepts</dt>
|
||||
<dd>is also a model of <em>Swappable Iterator</em>. <em>--end note</em>]</dd>
|
||||
@ -448,12 +644,11 @@ semantics.</p>
|
||||
<h4><a class="toc-backref" href="#id10" name="lvalue-iterators-lib-lvalue-iterators">Lvalue Iterators [lib.lvalue.iterators]</a></h4>
|
||||
<p>The <em>Lvalue Iterator</em> concept adds the requirement that the
|
||||
<tt class="literal"><span class="pre">reference</span></tt> type be a reference to the value type of the iterator.</p>
|
||||
<blockquote>
|
||||
<table border class="table">
|
||||
<colgroup>
|
||||
<col width="35%" />
|
||||
<col width="32%" />
|
||||
<col width="34%" />
|
||||
<col width="42%" />
|
||||
<col width="14%" />
|
||||
<col width="44%" />
|
||||
</colgroup>
|
||||
<thead valign="bottom">
|
||||
<tr><th colspan="3">Lvalue Iterator Requirements</th>
|
||||
@ -473,7 +668,6 @@ cv-qualification</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</blockquote>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="iterator-traversal-concepts-lib-iterator-traversal">
|
||||
@ -487,12 +681,11 @@ type <tt class="literal"><span class="pre">X</span></tt>, <tt class="literal"><s
|
||||
<p>A class or built-in type <tt class="literal"><span class="pre">X</span></tt> models the <em>Incrementable Iterator</em>
|
||||
concept if the following expressions are valid and respect the stated
|
||||
semantics.</p>
|
||||
<blockquote>
|
||||
<table border class="table">
|
||||
<colgroup>
|
||||
<col width="27%" />
|
||||
<col width="38%" />
|
||||
<col width="35%" />
|
||||
<col width="39%" />
|
||||
<col width="37%" />
|
||||
<col width="24%" />
|
||||
</colgroup>
|
||||
<thead valign="bottom">
|
||||
<tr><th colspan="3">Incrementable Iterator Requirements (in addition to Assignable, Copy Constructible)</th>
|
||||
@ -509,47 +702,56 @@ semantics.</p>
|
||||
</tr>
|
||||
<tr><td><tt class="literal"><span class="pre">r++</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">X</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">{</span> <span class="pre">X</span> <span class="pre">tmp</span> <span class="pre">=</span> <span class="pre">r;</span> <span class="pre">++r;</span> <span class="pre">return</span> <span class="pre">tmp;</span> <span class="pre">}</span></tt></td>
|
||||
<td><pre class="first last literal-block">
|
||||
{
|
||||
X tmp = r;
|
||||
++r;
|
||||
return tmp;
|
||||
}
|
||||
</pre>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td><tt class="literal"><span class="pre">traversal_category<X>::type</span></tt></td>
|
||||
<td>Convertible to <tt class="literal"><span class="pre">incrementable_iterator_tag</span></tt></td>
|
||||
<td>Convertible to
|
||||
<tt class="literal"><span class="pre">incrementable_iterator_tag</span></tt></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</blockquote>
|
||||
</div>
|
||||
<div class="section" id="single-pass-iterators-lib-single-pass-iterators">
|
||||
<h4><a class="toc-backref" href="#id13" name="single-pass-iterators-lib-single-pass-iterators">Single Pass Iterators [lib.single.pass.iterators]</a></h4>
|
||||
<p>A class or built-in type <tt class="literal"><span class="pre">X</span></tt> models the <em>Single Pass Iterator</em>
|
||||
concept if the following expressions are valid and respect the stated
|
||||
semantics.</p>
|
||||
<blockquote>
|
||||
<table border class="table">
|
||||
<colgroup>
|
||||
<col width="36%" />
|
||||
<col width="33%" />
|
||||
<col width="27%" />
|
||||
<col width="39%" />
|
||||
<col width="31%" />
|
||||
</colgroup>
|
||||
<thead valign="bottom">
|
||||
<tr><th colspan="3">Single Pass Iterator Requirements (in addition to Incrementable Iterator and Equality Comparable)</th>
|
||||
<tr><th colspan="3">Single Pass Iterator Requirements (in addition to Incrementable Iterator and Equality
|
||||
Comparable)</th>
|
||||
</tr>
|
||||
<tr><th>Expression</th>
|
||||
<th>Return Type</th>
|
||||
<th>Assertion/Semantics/Pre-/Post-condition</th>
|
||||
<th>Assertion/Semantics /
|
||||
Pre-/Post-condition</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody valign="top">
|
||||
<tr><td><tt class="literal"><span class="pre">++r</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">X&</span></tt></td>
|
||||
<td>pre: <tt class="literal"><span class="pre">r</span></tt> is dereferenceable; post:
|
||||
<tt class="literal"><span class="pre">r</span></tt> is dereferenceable or <tt class="literal"><span class="pre">r</span></tt> is
|
||||
past-the-end</td>
|
||||
<td>pre: <tt class="literal"><span class="pre">r</span></tt> is
|
||||
dereferenceable; post:
|
||||
<tt class="literal"><span class="pre">r</span></tt> is dereferenceable or
|
||||
<tt class="literal"><span class="pre">r</span></tt> is past-the-end</td>
|
||||
</tr>
|
||||
<tr><td><tt class="literal"><span class="pre">a</span> <span class="pre">==</span> <span class="pre">b</span></tt></td>
|
||||
<td>convertible to <tt class="literal"><span class="pre">bool</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">==</span></tt> is an equivalence relation over
|
||||
its domain</td>
|
||||
<td><tt class="literal"><span class="pre">==</span></tt> is an equivalence
|
||||
relation over its domain</td>
|
||||
</tr>
|
||||
<tr><td><tt class="literal"><span class="pre">a</span> <span class="pre">!=</span> <span class="pre">b</span></tt></td>
|
||||
<td>convertible to <tt class="literal"><span class="pre">bool</span></tt></td>
|
||||
@ -562,19 +764,17 @@ its domain</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</blockquote>
|
||||
</div>
|
||||
<div class="section" id="forward-traversal-iterators-lib-forward-traversal-iterators">
|
||||
<h4><a class="toc-backref" href="#id14" name="forward-traversal-iterators-lib-forward-traversal-iterators">Forward Traversal Iterators [lib.forward.traversal.iterators]</a></h4>
|
||||
<p>A class or built-in type <tt class="literal"><span class="pre">X</span></tt> models the <em>Forward Traversal Iterator</em>
|
||||
concept if the following expressions are valid and respect the stated
|
||||
semantics.</p>
|
||||
<blockquote>
|
||||
<table border class="table">
|
||||
<colgroup>
|
||||
<col width="44%" />
|
||||
<col width="39%" />
|
||||
<col width="37%" />
|
||||
<col width="24%" />
|
||||
<col width="17%" />
|
||||
</colgroup>
|
||||
<thead valign="bottom">
|
||||
<tr><th colspan="3">Forward Traversal Iterator Requirements (in addition to Single Pass Iterator)</th>
|
||||
@ -587,14 +787,17 @@ semantics.</p>
|
||||
<tbody valign="top">
|
||||
<tr><td><tt class="literal"><span class="pre">X</span> <span class="pre">u;</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">X&</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">note:</span> <span class="pre">u</span> <span class="pre">may</span> <span class="pre">have</span> <span class="pre">a</span>
|
||||
<span class="pre">singular</span> <span class="pre">value.</span></tt></td>
|
||||
<td>note: <tt class="literal"><span class="pre">u</span></tt> may
|
||||
have a singular
|
||||
value.</td>
|
||||
</tr>
|
||||
<tr><td><tt class="literal"><span class="pre">++r</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">X&</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">r</span> <span class="pre">==</span> <span class="pre">s</span></tt> and <tt class="literal"><span class="pre">r</span></tt> is
|
||||
dereferenceable implies
|
||||
<tt class="literal"><span class="pre">++r</span> <span class="pre">==</span> <span class="pre">++s.</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">r</span> <span class="pre">==</span> <span class="pre">s</span></tt> and
|
||||
<tt class="literal"><span class="pre">r</span></tt> is
|
||||
dereferenceable
|
||||
implies <tt class="literal"><span class="pre">++r</span>
|
||||
<span class="pre">==</span> <span class="pre">++s.</span></tt></td>
|
||||
</tr>
|
||||
<tr><td><tt class="literal"><span class="pre">iterator_traits<X>::difference_type</span></tt></td>
|
||||
<td>A signed integral type representing
|
||||
@ -608,40 +811,50 @@ the distance between iterators</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</blockquote>
|
||||
</div>
|
||||
<div class="section" id="bidirectional-traversal-iterators-lib-bidirectional-traversal-iterators">
|
||||
<h4><a class="toc-backref" href="#id15" name="bidirectional-traversal-iterators-lib-bidirectional-traversal-iterators">Bidirectional Traversal Iterators [lib.bidirectional.traversal.iterators]</a></h4>
|
||||
<p>A class or built-in type <tt class="literal"><span class="pre">X</span></tt> models the <em>Bidirectional Traversal
|
||||
Iterator</em> concept if the following expressions are valid and respect
|
||||
the stated semantics.</p>
|
||||
<blockquote>
|
||||
<table border class="table">
|
||||
<colgroup>
|
||||
<col width="28%" />
|
||||
<col width="36%" />
|
||||
<col width="35%" />
|
||||
<col width="44%" />
|
||||
<col width="21%" />
|
||||
</colgroup>
|
||||
<thead valign="bottom">
|
||||
<tr><th colspan="3">Bidirectional Traversal Iterator Requirements (in addition to Forward Traversal Iterator)</th>
|
||||
</tr>
|
||||
<tr><th>Expression</th>
|
||||
<th>Return Type</th>
|
||||
<th>Assertion/Semantics/Pre-/Post-condition</th>
|
||||
<th>Assertion/Semantics /
|
||||
Pre-/Post-condition</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody valign="top">
|
||||
<tr><td><tt class="literal"><span class="pre">--r</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">X&</span></tt></td>
|
||||
<td>pre: there exists <tt class="literal"><span class="pre">s</span></tt> such that <tt class="literal"><span class="pre">r</span>
|
||||
<span class="pre">==</span> <span class="pre">++s</span></tt>. post: <tt class="literal"><span class="pre">s</span></tt> is
|
||||
dereferenceable. <tt class="literal"><span class="pre">--(++r)</span> <span class="pre">==</span> <span class="pre">r</span></tt>.
|
||||
<tt class="literal"><span class="pre">--r</span> <span class="pre">==</span> <span class="pre">--s</span></tt> implies <tt class="literal"><span class="pre">r</span> <span class="pre">==</span> <span class="pre">s</span></tt>. <tt class="literal"><span class="pre">&r</span>
|
||||
<span class="pre">==</span> <span class="pre">&--r</span></tt>.</td>
|
||||
<td>pre: there exists
|
||||
<tt class="literal"><span class="pre">s</span></tt> such that <tt class="literal"><span class="pre">r</span>
|
||||
<span class="pre">==</span> <span class="pre">++s</span></tt>. post:
|
||||
<tt class="literal"><span class="pre">s</span></tt> is
|
||||
dereferenceable.
|
||||
<tt class="literal"><span class="pre">--(++r)</span> <span class="pre">==</span> <span class="pre">r</span></tt>.
|
||||
<tt class="literal"><span class="pre">--r</span> <span class="pre">==</span> <span class="pre">--s</span></tt>
|
||||
implies <tt class="literal"><span class="pre">r</span> <span class="pre">==</span>
|
||||
<span class="pre">s</span></tt>. <tt class="literal"><span class="pre">&r</span> <span class="pre">==</span> <span class="pre">&--r</span></tt>.</td>
|
||||
</tr>
|
||||
<tr><td><tt class="literal"><span class="pre">r--</span></tt></td>
|
||||
<td>convertible to <tt class="literal"><span class="pre">const</span> <span class="pre">X&</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">{</span> <span class="pre">X</span> <span class="pre">tmp</span> <span class="pre">=</span> <span class="pre">r;</span> <span class="pre">--r;</span> <span class="pre">return</span> <span class="pre">tmp;</span> <span class="pre">}</span></tt></td>
|
||||
<td><pre class="first last literal-block">
|
||||
{
|
||||
X tmp = r;
|
||||
--r;
|
||||
return tmp;
|
||||
}
|
||||
</pre>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td><tt class="literal"><span class="pre">traversal_category<X>::type</span></tt></td>
|
||||
<td>Convertible to
|
||||
@ -650,7 +863,6 @@ dereferenceable. <tt class="literal"><span class="pre">--(++r)</span> <span clas
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</blockquote>
|
||||
</div>
|
||||
<div class="section" id="random-access-traversal-iterators-lib-random-access-traversal-iterators">
|
||||
<h4><a class="toc-backref" href="#id16" name="random-access-traversal-iterators-lib-random-access-traversal-iterators">Random Access Traversal Iterators [lib.random.access.traversal.iterators]</a></h4>
|
||||
@ -659,13 +871,12 @@ Iterator</em> concept if the following expressions are valid and respect
|
||||
the stated semantics. In the table below, <tt class="literal"><span class="pre">Distance</span></tt> is
|
||||
<tt class="literal"><span class="pre">iterator_traits<X>::difference_type</span></tt> and <tt class="literal"><span class="pre">n</span></tt> represents a
|
||||
constant object of type <tt class="literal"><span class="pre">Distance</span></tt>.</p>
|
||||
<blockquote>
|
||||
<table border class="table">
|
||||
<colgroup>
|
||||
<col width="26%" />
|
||||
<col width="33%" />
|
||||
<col width="31%" />
|
||||
<col width="35%" />
|
||||
<col width="18%" />
|
||||
<col width="24%" />
|
||||
<col width="16%" />
|
||||
</colgroup>
|
||||
<thead valign="bottom">
|
||||
<tr><th colspan="4">Random Access Traversal Iterator Requirements (in addition to Bidirectional Traversal Iterator)</th>
|
||||
@ -673,7 +884,8 @@ constant object of type <tt class="literal"><span class="pre">Distance</span></t
|
||||
<tr><th>Expression</th>
|
||||
<th>Return Type</th>
|
||||
<th>Operational Semantics</th>
|
||||
<th>Assertion/Precondition</th>
|
||||
<th>Assertion/
|
||||
Precondition</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody valign="top">
|
||||
@ -696,8 +908,8 @@ constant object of type <tt class="literal"><span class="pre">Distance</span></t
|
||||
</tr>
|
||||
<tr><td><tt class="literal"><span class="pre">a</span> <span class="pre">+</span> <span class="pre">n</span></tt>, <tt class="literal"><span class="pre">n</span> <span class="pre">+</span> <span class="pre">a</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">X</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">{</span> <span class="pre">X</span> <span class="pre">tmp</span> <span class="pre">=</span> <span class="pre">a;</span> <span class="pre">return</span>
|
||||
<span class="pre">tmp</span> <span class="pre">+=</span> <span class="pre">n;</span> <span class="pre">}</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">{</span> <span class="pre">X</span> <span class="pre">tmp</span> <span class="pre">=</span> <span class="pre">a;</span> <span class="pre">return</span> <span class="pre">tmp</span>
|
||||
<span class="pre">+=</span> <span class="pre">n;</span> <span class="pre">}</span></tt></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr><td><tt class="literal"><span class="pre">r</span> <span class="pre">-=</span> <span class="pre">n</span></tt></td>
|
||||
@ -707,19 +919,19 @@ constant object of type <tt class="literal"><span class="pre">Distance</span></t
|
||||
</tr>
|
||||
<tr><td><tt class="literal"><span class="pre">a</span> <span class="pre">-</span> <span class="pre">n</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">X</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">{</span> <span class="pre">X</span> <span class="pre">tmp</span> <span class="pre">=</span> <span class="pre">a;</span> <span class="pre">return</span>
|
||||
<span class="pre">tmp</span> <span class="pre">-=</span> <span class="pre">n;</span> <span class="pre">}</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">{</span> <span class="pre">X</span> <span class="pre">tmp</span> <span class="pre">=</span> <span class="pre">a;</span> <span class="pre">return</span> <span class="pre">tmp</span>
|
||||
<span class="pre">-=</span> <span class="pre">n;</span> <span class="pre">}</span></tt></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr><td><tt class="literal"><span class="pre">b</span> <span class="pre">-</span> <span class="pre">a</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">Distance</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">a</span> <span class="pre"><</span> <span class="pre">b</span> <span class="pre">?</span>
|
||||
<span class="pre">distance(a,b)</span> <span class="pre">:</span>
|
||||
<span class="pre">-distance(b,a)</span></tt></td>
|
||||
<td>pre: there exists a value
|
||||
<tt class="literal"><span class="pre">n</span></tt> of <tt class="literal"><span class="pre">Distance</span></tt> such
|
||||
that <tt class="literal"><span class="pre">a</span> <span class="pre">+</span> <span class="pre">n</span> <span class="pre">==</span> <span class="pre">b</span></tt>. <tt class="literal"><span class="pre">b</span> <span class="pre">==</span>
|
||||
<span class="pre">a</span> <span class="pre">+</span> <span class="pre">(b</span> <span class="pre">-</span> <span class="pre">a)</span></tt>.</td>
|
||||
<td><tt class="literal"><span class="pre">a</span> <span class="pre"><</span> <span class="pre">b</span> <span class="pre">?</span> <span class="pre">distance(a,b)</span>
|
||||
<span class="pre">:</span> <span class="pre">-distance(b,a)</span></tt></td>
|
||||
<td>pre: there exists a
|
||||
value <tt class="literal"><span class="pre">n</span></tt> of
|
||||
<tt class="literal"><span class="pre">Distance</span></tt> such that
|
||||
<tt class="literal"><span class="pre">a</span> <span class="pre">+</span> <span class="pre">n</span> <span class="pre">==</span> <span class="pre">b</span></tt>. <tt class="literal"><span class="pre">b</span>
|
||||
<span class="pre">==</span> <span class="pre">a</span> <span class="pre">+</span> <span class="pre">(b</span> <span class="pre">-</span> <span class="pre">a)</span></tt>.</td>
|
||||
</tr>
|
||||
<tr><td><tt class="literal"><span class="pre">a[n]</span></tt></td>
|
||||
<td>convertible to T</td>
|
||||
@ -736,14 +948,14 @@ iterator</a></td>
|
||||
<tr><td><tt class="literal"><span class="pre">a</span> <span class="pre"><</span> <span class="pre">b</span></tt></td>
|
||||
<td>convertible to <tt class="literal"><span class="pre">bool</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">b</span> <span class="pre">-</span> <span class="pre">a</span> <span class="pre">></span> <span class="pre">0</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre"><</span></tt> is a total ordering
|
||||
relation</td>
|
||||
<td><tt class="literal"><span class="pre"><</span></tt> is a total
|
||||
ordering relation</td>
|
||||
</tr>
|
||||
<tr><td><tt class="literal"><span class="pre">a</span> <span class="pre">></span> <span class="pre">b</span></tt></td>
|
||||
<td>convertible to <tt class="literal"><span class="pre">bool</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">b</span> <span class="pre"><</span> <span class="pre">a</span></tt></td>
|
||||
<td><tt class="literal"><span class="pre">></span></tt> is a total ordering
|
||||
relation</td>
|
||||
<td><tt class="literal"><span class="pre">></span></tt> is a total
|
||||
ordering relation</td>
|
||||
</tr>
|
||||
<tr><td><tt class="literal"><span class="pre">a</span> <span class="pre">>=</span> <span class="pre">b</span></tt></td>
|
||||
<td>convertible to <tt class="literal"><span class="pre">bool</span></tt></td>
|
||||
@ -763,7 +975,6 @@ relation</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</blockquote>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -925,5 +1136,11 @@ LocalWords: TraversalTag typename lvalues DWA Hmm JGS -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr class="footer" />
|
||||
<div class="footer">
|
||||
<a class="reference" href="new-iter-concepts.rst">View document source</a>.
|
||||
Generated on: 2003-09-22 15:08 UTC.
|
||||
Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -42,7 +42,9 @@ requirements that address value access sneak in at various places. The
|
||||
following table gives a summary of the current value access
|
||||
requirements in the iterator categories.
|
||||
|
||||
+------------------------+-----------------------------------------------------+
|
||||
+------------------------------------------------------------------------------+
|
||||
|Value Access Requirements in Existing Iterator Categories |
|
||||
+========================+=====================================================+
|
||||
|Output Iterator |``*i = a`` |
|
||||
+------------------------+-----------------------------------------------------+
|
||||
|Input Iterator |``*i`` is convertible to ``T`` |
|
||||
@ -138,7 +140,9 @@ algorithms.
|
||||
|
||||
Forward Iterator -> Forward Traversal Iterator and Readable Iterator
|
||||
|
||||
``find_end, adjacent_find, search, search_n, rotate_copy, lower_bound, upper_bound, equal_range, binary_search, min_element, max_element``
|
||||
``find_end, adjacent_find, search, search_n, rotate_copy,
|
||||
lower_bound, upper_bound, equal_range, binary_search,
|
||||
min_element, max_element``
|
||||
|
||||
Forward Iterator (1) -> Single Pass Iterator and Readable Iterator
|
||||
Forward Iterator (2) -> Forward Traversal Iterator and Readable Iterator
|
||||
@ -203,7 +207,7 @@ Input Iterator (2) -> Incrementable Iterator and Readable Iterator
|
||||
Design
|
||||
========
|
||||
|
||||
The iterator requirements are be separated into two hierarchies. One
|
||||
The iterator requirements are to be separated into two hierarchies. One
|
||||
set of concepts handles the syntax and semantics of value access:
|
||||
|
||||
- Readable Iterator
|
||||
@ -240,7 +244,7 @@ given in the following diagram.
|
||||
|
||||
.. image:: oldeqnew.png
|
||||
|
||||
Like the old iterator requirements, we provide tags for purposes of
|
||||
As in the existing library, we provide tags for purposes of
|
||||
dispatching. There are two hierarchies of tags, one for the access
|
||||
concepts and one for the traversal concepts. The tags are related via
|
||||
inheritance so that a tag is convertible to another tag if the concept
|
||||
@ -252,7 +256,7 @@ whether an iterator is an Lvalue Iterator by checking whether
|
||||
|
||||
We provide an access mechanism for mapping iterator types to the new
|
||||
tags. Our design reuses ``iterator_traits<Iter>::iterator_category``
|
||||
as the access mechanism. To enable this, a pair of access and
|
||||
as the access mechanism. To that end, a pair of access and
|
||||
traversal tags are combined into a single type using the following
|
||||
`iterator_tag` class.
|
||||
|
||||
@ -325,24 +329,28 @@ for the value type ``T`` if the following expressions are valid and
|
||||
respect the stated semantics. ``U`` is the type of any specified
|
||||
member of type ``T``.
|
||||
|
||||
+-------------------------------------------------------------------------------------------------------------------+
|
||||
|Readable Iterator Requirements (in addition to CopyConstructible) |
|
||||
+--------------------------------------+----------------------------------+-----------------------------------------+
|
||||
|Expression |Return Type |Assertion/Note/Precondition/Postcondition|
|
||||
+======================================+==================================+=========================================+
|
||||
|``iterator_traits<X>::value_type`` |``T`` |Any non-reference, non-cv-qualified type |
|
||||
+--------------------------------------+----------------------------------+-----------------------------------------+
|
||||
|``iterator_traits<X>::reference`` |Convertible to | |
|
||||
| |``iterator_traits<X>::value_type``| |
|
||||
+--------------------------------------+----------------------------------+-----------------------------------------+
|
||||
|``is_readable<X>::type`` |``truetype`` | |
|
||||
+--------------------------------------+----------------------------------+-----------------------------------------+
|
||||
|``*a`` |``iterator_traits<X>::reference`` |pre: ``a`` is dereferenceable. If ``a == |
|
||||
| | |b`` then ``*a`` is equivalent to ``*b`` |
|
||||
+--------------------------------------+----------------------------------+-----------------------------------------+
|
||||
|``a->m`` |``U&`` |pre: ``(*a).m`` is well-defined. |
|
||||
| | |Equivalent to ``(*a).m`` |
|
||||
+--------------------------------------+----------------------------------+-----------------------------------------+
|
||||
+-------------------------------------------------------------------------------------------------+
|
||||
|Readable Iterator Requirements (in addition to CopyConstructible) |
|
||||
+-----------------------------------+-----------------------------------+-------------------------+
|
||||
|Expression |Return Type |Note/Precondition |
|
||||
+===================================+===================================+=========================+
|
||||
|``iterator_traits<X>::value_type`` |``T`` |Any non-reference, |
|
||||
| | |non-cv-qualified type |
|
||||
+-----------------------------------+-----------------------------------+-------------------------+
|
||||
|``iterator_traits<X>::reference`` |Convertible to | |
|
||||
| |``iterator_traits<X>::value_type`` | |
|
||||
+-----------------------------------+-----------------------------------+-------------------------+
|
||||
|``is_readable<X>::type`` |``true_type`` | |
|
||||
+-----------------------------------+-----------------------------------+-------------------------+
|
||||
|``*a`` |``iterator_traits<X>::reference`` |pre: ``a`` is |
|
||||
| | |dereferenceable. If ``a |
|
||||
| | |== b`` then ``*a`` is |
|
||||
| | |equivalent to ``*b`` |
|
||||
+-----------------------------------+-----------------------------------+-------------------------+
|
||||
|``a->m`` |``U&`` |pre: ``(*a).m`` is |
|
||||
| | |well-defined. Equivalent|
|
||||
| | |to ``(*a).m`` |
|
||||
+-----------------------------------+-----------------------------------+-------------------------+
|
||||
|
||||
|
||||
.. _Writable Iterator:
|
||||
@ -356,17 +364,17 @@ semantics. In addition, a model of *Writable Iterator* must include
|
||||
in its documentation the *set of value types* that it allows for
|
||||
output.
|
||||
|
||||
+---------------------------------------------------------------------------------------------+
|
||||
|Writable Iterator Requirements (in addition to CopyConstructible) |
|
||||
+--------------------------------------+-------------------------+----------------------------+
|
||||
|Expression |Return Type |Precondition |
|
||||
+======================================+=========================+============================+
|
||||
|``is_writable<X>::type`` |``true_type`` | |
|
||||
+--------------------------------------+-------------------------+----------------------------+
|
||||
|``*a = o`` | | pre: The type of ``o`` |
|
||||
| | | is in the set of |
|
||||
| | | value types of ``X`` |
|
||||
+--------------------------------------+-------------------------+----------------------------+
|
||||
+---------------------------------------------------------------------+
|
||||
|Writable Iterator Requirements (in addition to CopyConstructible) |
|
||||
+-------------------------+--------------+----------------------------+
|
||||
|Expression |Return Type |Precondition |
|
||||
+=========================+==============+============================+
|
||||
|``is_writable<X>::type`` |``true_type`` | |
|
||||
+-------------------------+--------------+----------------------------+
|
||||
|``*a = o`` | | pre: The type of ``o`` |
|
||||
| | | is in the set of |
|
||||
| | | value types of ``X`` |
|
||||
+-------------------------+--------------+----------------------------+
|
||||
|
||||
|
||||
|
||||
@ -377,15 +385,16 @@ A class or built-in type ``X`` models the *Swappable Iterator* concept
|
||||
if the following expressions are valid and respect the stated
|
||||
semantics.
|
||||
|
||||
+------------------------------------------------------------------------------------------------+
|
||||
|Swappable Iterator Requirements (in addition to CopyConstructible) |
|
||||
+------------------------------------+-------------+---------------------------------------------+
|
||||
|Expression |Return Type |Postcondition |
|
||||
+====================================+=============+=============================================+
|
||||
|``is_swappable<X>::type`` |``true_type``| |
|
||||
+------------------------------------+-------------+---------------------------------------------+
|
||||
|``iter_swap(a, b)`` |``void`` |post: the pointed to values are exchanged |
|
||||
+------------------------------------+-------------+---------------------------------------------+
|
||||
+---------------------------------------------------------------------+
|
||||
|Swappable Iterator Requirements (in addition to CopyConstructible) |
|
||||
+-------------------------+-------------+-----------------------------+
|
||||
|Expression |Return Type |Postcondition |
|
||||
+=========================+=============+=============================+
|
||||
|``is_swappable<X>::type``|``true_type``| |
|
||||
+-------------------------+-------------+-----------------------------+
|
||||
|``iter_swap(a, b)`` |``void`` |the pointed to values are |
|
||||
| | |exchanged |
|
||||
+-------------------------+-------------+-----------------------------+
|
||||
|
||||
[*Note:* An iterator that is a model of the *Readable* and *Writable Iterator* concepts
|
||||
is also a model of *Swappable Iterator*. *--end note*]
|
||||
@ -397,16 +406,16 @@ Lvalue Iterators [lib.lvalue.iterators]
|
||||
The *Lvalue Iterator* concept adds the requirement that the
|
||||
``reference`` type be a reference to the value type of the iterator.
|
||||
|
||||
+----------------------------------------------------------------------------------------------------------+
|
||||
| Lvalue Iterator Requirements |
|
||||
+------------------------------------+---------------------------------+-----------------------------------+
|
||||
|Expression |Return Type |Assertion |
|
||||
+====================================+=================================+===================================+
|
||||
|``iterator_traits<X>::reference`` |``T&`` |``T`` is *cv* |
|
||||
| | |``iterator_traits<X>::value_type`` |
|
||||
| | |where *cv* is an optional |
|
||||
| | |cv-qualification |
|
||||
+------------------------------------+---------------------------------+-----------------------------------+
|
||||
+---------------------------------------------------------------------------------+
|
||||
| Lvalue Iterator Requirements |
|
||||
+---------------------------------+-----------+-----------------------------------+
|
||||
|Expression |Return Type|Assertion |
|
||||
+=================================+===========+===================================+
|
||||
|``iterator_traits<X>::reference``|``T&`` |``T`` is *cv* |
|
||||
| | |``iterator_traits<X>::value_type`` |
|
||||
| | |where *cv* is an optional |
|
||||
| | |cv-qualification |
|
||||
+---------------------------------+-----------+-----------------------------------+
|
||||
|
||||
|
||||
Iterator Traversal Concepts [lib.iterator.traversal]
|
||||
@ -426,17 +435,25 @@ concept if the following expressions are valid and respect the stated
|
||||
semantics.
|
||||
|
||||
|
||||
+-------------------------------------------------------------------------------------------------------------------------+
|
||||
|Incrementable Iterator Requirements (in addition to Assignable, Copy Constructible) |
|
||||
+--------------------------------+---------------------------------------------+------------------------------------------+
|
||||
|Expression |Return Type |Assertion/Semantics |
|
||||
+================================+=============================================+==========================================+
|
||||
|``++r`` |``X&`` |``&r == &++r`` |
|
||||
+--------------------------------+---------------------------------------------+------------------------------------------+
|
||||
|``r++`` |``X`` |``{ X tmp = r; ++r; return tmp; }`` |
|
||||
+--------------------------------+---------------------------------------------+------------------------------------------+
|
||||
|``traversal_category<X>::type`` |Convertible to ``incrementable_iterator_tag``| |
|
||||
+--------------------------------+---------------------------------------------+------------------------------------------+
|
||||
+-------------------------------------------------------------------------------------+
|
||||
|Incrementable Iterator Requirements (in addition to Assignable, Copy Constructible) |
|
||||
| |
|
||||
+--------------------------------+-------------------------------+--------------------+
|
||||
|Expression |Return Type |Assertion/Semantics |
|
||||
+================================+===============================+====================+
|
||||
|``++r`` |``X&`` |``&r == &++r`` |
|
||||
+--------------------------------+-------------------------------+--------------------+
|
||||
|``r++`` |``X`` |:: |
|
||||
| | | |
|
||||
| | | { |
|
||||
| | | X tmp = r; |
|
||||
| | | ++r; |
|
||||
| | | return tmp; |
|
||||
| | | } |
|
||||
+--------------------------------+-------------------------------+--------------------+
|
||||
|``traversal_category<X>::type`` |Convertible to | |
|
||||
| |``incrementable_iterator_tag`` | |
|
||||
+--------------------------------+-------------------------------+--------------------+
|
||||
|
||||
|
||||
Single Pass Iterators [lib.single.pass.iterators]
|
||||
@ -447,23 +464,26 @@ concept if the following expressions are valid and respect the stated
|
||||
semantics.
|
||||
|
||||
|
||||
+--------------------------------------------------------------------------------------------------------+
|
||||
|Single Pass Iterator Requirements (in addition to Incrementable Iterator and Equality Comparable) |
|
||||
+----------------------------------+----------------------------+----------------------------------------+
|
||||
|Expression |Return Type |Assertion/Semantics/Pre-/Post-condition |
|
||||
+==================================+============================+========================================+
|
||||
|``++r`` |``X&`` |pre: ``r`` is dereferenceable; post: |
|
||||
| | |``r`` is dereferenceable or ``r`` is |
|
||||
| | |past-the-end |
|
||||
+----------------------------------+----------------------------+----------------------------------------+
|
||||
|``a == b`` |convertible to ``bool`` |``==`` is an equivalence relation over |
|
||||
| | |its domain |
|
||||
+----------------------------------+----------------------------+----------------------------------------+
|
||||
|``a != b`` |convertible to ``bool`` |``!(a == b)`` |
|
||||
+----------------------------------+----------------------------+----------------------------------------+
|
||||
|``traversal_category<X>::type`` |Convertible to | |
|
||||
| |``single_pass_iterator_tag``| |
|
||||
+----------------------------------+----------------------------+----------------------------------------+
|
||||
+------------------------------------------------------------------------------------------+
|
||||
|Single Pass Iterator Requirements (in addition to Incrementable Iterator and Equality |
|
||||
|Comparable) |
|
||||
+--------------------------------+-----------------------------+---------------------------+
|
||||
|Expression |Return Type |Assertion/Semantics / |
|
||||
| | |Pre-/Post-condition |
|
||||
+================================+=============================+===========================+
|
||||
|``++r`` |``X&`` |pre: ``r`` is |
|
||||
| | |dereferenceable; post: |
|
||||
| | |``r`` is dereferenceable or|
|
||||
| | |``r`` is past-the-end |
|
||||
+--------------------------------+-----------------------------+---------------------------+
|
||||
|``a == b`` |convertible to ``bool`` |``==`` is an equivalence |
|
||||
| | |relation over its domain |
|
||||
+--------------------------------+-----------------------------+---------------------------+
|
||||
|``a != b`` |convertible to ``bool`` |``!(a == b)`` |
|
||||
+--------------------------------+-----------------------------+---------------------------+
|
||||
|``traversal_category<X>::type`` |Convertible to | |
|
||||
| |``single_pass_iterator_tag`` | |
|
||||
+--------------------------------+-----------------------------+---------------------------+
|
||||
|
||||
|
||||
Forward Traversal Iterators [lib.forward.traversal.iterators]
|
||||
@ -473,24 +493,28 @@ A class or built-in type ``X`` models the *Forward Traversal Iterator*
|
||||
concept if the following expressions are valid and respect the stated
|
||||
semantics.
|
||||
|
||||
+------------------------------------------------------------------------------------------------------+
|
||||
|Forward Traversal Iterator Requirements (in addition to Single Pass Iterator) |
|
||||
+---------------------------------------+-------------------------------------+------------------------+
|
||||
|Expression |Return Type |Assertion/Note |
|
||||
+=======================================+=====================================+========================+
|
||||
|``X u;`` |``X&`` |``note: u may have a |
|
||||
| | |singular value.`` |
|
||||
+---------------------------------------+-------------------------------------+------------------------+
|
||||
|``++r`` |``X&`` |``r == s`` and ``r`` is |
|
||||
| | |dereferenceable implies |
|
||||
| | |``++r == ++s.`` |
|
||||
+---------------------------------------+-------------------------------------+------------------------+
|
||||
|``iterator_traits<X>::difference_type``|A signed integral type representing | |
|
||||
| |the distance between iterators | |
|
||||
+---------------------------------------+-------------------------------------+------------------------+
|
||||
|``traversal_category<X>::type`` |Convertible to | |
|
||||
| |``forward_traversal_iterator_tag`` | |
|
||||
+---------------------------------------+-------------------------------------+------------------------+
|
||||
+-------------------------------------------------------------------------------------------+
|
||||
|Forward Traversal Iterator Requirements (in addition to Single Pass Iterator) |
|
||||
+---------------------------------------+-----------------------------------+---------------+
|
||||
|Expression |Return Type |Assertion/Note |
|
||||
+=======================================+===================================+===============+
|
||||
|``X u;`` |``X&`` |note: ``u`` may|
|
||||
| | |have a singular|
|
||||
| | |value. |
|
||||
+---------------------------------------+-----------------------------------+---------------+
|
||||
|``++r`` |``X&`` |``r == s`` and |
|
||||
| | |``r`` is |
|
||||
| | |dereferenceable|
|
||||
| | |implies ``++r |
|
||||
| | |== ++s.`` |
|
||||
+---------------------------------------+-----------------------------------+---------------+
|
||||
|``iterator_traits<X>::difference_type``|A signed integral type representing| |
|
||||
| |the distance between iterators | |
|
||||
| | | |
|
||||
+---------------------------------------+-----------------------------------+---------------+
|
||||
|``traversal_category<X>::type`` |Convertible to | |
|
||||
| |``forward_traversal_iterator_tag`` | |
|
||||
+---------------------------------------+-----------------------------------+---------------+
|
||||
|
||||
|
||||
Bidirectional Traversal Iterators [lib.bidirectional.traversal.iterators]
|
||||
@ -500,25 +524,34 @@ A class or built-in type ``X`` models the *Bidirectional Traversal
|
||||
Iterator* concept if the following expressions are valid and respect
|
||||
the stated semantics.
|
||||
|
||||
+----------------------------------------------------------------------------------------------------------------+
|
||||
|Bidirectional Traversal Iterator Requirements (in addition to Forward Traversal Iterator) |
|
||||
+-------------------------------+----------------------------------------+---------------------------------------+
|
||||
|Expression |Return Type |Assertion/Semantics/Pre-/Post-condition|
|
||||
+===============================+========================================+=======================================+
|
||||
|``--r`` |``X&`` |pre: there exists ``s`` such that ``r |
|
||||
| | |== ++s``. post: ``s`` is |
|
||||
| | |dereferenceable. ``--(++r) == r``. |
|
||||
| | |``--r == --s`` implies ``r == s``. ``&r|
|
||||
| | |== &--r``. |
|
||||
+-------------------------------+----------------------------------------+---------------------------------------+
|
||||
|``r--`` |convertible to ``const X&`` |``{ X tmp = r; --r; return tmp; }`` |
|
||||
| | | |
|
||||
| | | |
|
||||
+-------------------------------+----------------------------------------+---------------------------------------+
|
||||
|``traversal_category<X>::type``|Convertible to | |
|
||||
| |``bidirectional_traversal_iterator_tag``| |
|
||||
| | | |
|
||||
+-------------------------------+----------------------------------------+---------------------------------------+
|
||||
+--------------------------------------------------------------------------------------------------------+
|
||||
|Bidirectional Traversal Iterator Requirements (in addition to Forward Traversal Iterator) |
|
||||
+------------------------------------+---------------------------------------------+---------------------+
|
||||
|Expression |Return Type |Assertion/Semantics /|
|
||||
| | |Pre-/Post-condition |
|
||||
+====================================+=============================================+=====================+
|
||||
|``--r`` |``X&`` |pre: there exists |
|
||||
| | |``s`` such that ``r |
|
||||
| | |== ++s``. post: |
|
||||
| | |``s`` is |
|
||||
| | |dereferenceable. |
|
||||
| | |``--(++r) == r``. |
|
||||
| | |``--r == --s`` |
|
||||
| | |implies ``r == |
|
||||
| | |s``. ``&r == &--r``. |
|
||||
+------------------------------------+---------------------------------------------+---------------------+
|
||||
|``r--`` |convertible to ``const X&`` |:: |
|
||||
| | | |
|
||||
| | | { |
|
||||
| | | X tmp = r; |
|
||||
| | | --r; |
|
||||
| | | return tmp; |
|
||||
| | | } |
|
||||
+------------------------------------+---------------------------------------------+---------------------+
|
||||
|``traversal_category<X>::type`` |Convertible to | |
|
||||
| |``bidirectional_traversal_iterator_tag`` | |
|
||||
| | | |
|
||||
+------------------------------------+---------------------------------------------+---------------------+
|
||||
|
||||
|
||||
Random Access Traversal Iterators [lib.random.access.traversal.iterators]
|
||||
@ -530,56 +563,60 @@ the stated semantics. In the table below, ``Distance`` is
|
||||
``iterator_traits<X>::difference_type`` and ``n`` represents a
|
||||
constant object of type ``Distance``.
|
||||
|
||||
+------------------------------------------------------------------------------------------------------------------------------+
|
||||
|Random Access Traversal Iterator Requirements (in addition to Bidirectional Traversal Iterator) |
|
||||
+--------------------------------+----------------------------------------+----------------------+-----------------------------+
|
||||
| Expression |Return Type | Operational Semantics| Assertion/Precondition |
|
||||
+================================+========================================+======================+=============================+
|
||||
|``r += n`` |``X&`` |:: | |
|
||||
| | | | |
|
||||
| | | { | |
|
||||
| | | Distance m = n; | |
|
||||
| | | if (m >= 0) | |
|
||||
| | | while (m--) | |
|
||||
| | | ++r; | |
|
||||
| | | else | |
|
||||
| | | while (m++) | |
|
||||
| | | --r; | |
|
||||
| | | return r; | |
|
||||
| | | } | |
|
||||
+--------------------------------+----------------------------------------+----------------------+-----------------------------+
|
||||
| ``a + n``, ``n + a`` |``X`` |``{ X tmp = a; return | |
|
||||
| | |tmp += n; }`` | |
|
||||
+--------------------------------+----------------------------------------+----------------------+-----------------------------+
|
||||
|``r -= n`` |``X&`` |``return r += -n`` | |
|
||||
+--------------------------------+----------------------------------------+----------------------+-----------------------------+
|
||||
|``a - n`` |``X`` |``{ X tmp = a; return | |
|
||||
| | |tmp -= n; }`` | |
|
||||
+--------------------------------+----------------------------------------+----------------------+-----------------------------+
|
||||
|``b - a`` |``Distance`` |``a < b ? |pre: there exists a value |
|
||||
| | |distance(a,b) : |``n`` of ``Distance`` such |
|
||||
| | |-distance(b,a)`` |that ``a + n == b``. ``b == |
|
||||
| | | |a + (b - a)``. |
|
||||
+--------------------------------+----------------------------------------+----------------------+-----------------------------+
|
||||
|``a[n]`` |convertible to T |``*(a + n)`` |pre: a is a `readable |
|
||||
| | | |iterator`_ |
|
||||
+--------------------------------+----------------------------------------+----------------------+-----------------------------+
|
||||
|``a[n] = v`` |convertible to T |``*(a + n) = v`` |pre: a is a `writable |
|
||||
| | | |iterator`_ |
|
||||
+--------------------------------+----------------------------------------+----------------------+-----------------------------+
|
||||
|``a < b`` |convertible to ``bool`` |``b - a > 0`` |``<`` is a total ordering |
|
||||
| | | |relation |
|
||||
+--------------------------------+----------------------------------------+----------------------+-----------------------------+
|
||||
|``a > b`` |convertible to ``bool`` |``b < a`` |``>`` is a total ordering |
|
||||
| | | |relation |
|
||||
+--------------------------------+----------------------------------------+----------------------+-----------------------------+
|
||||
|``a >= b`` |convertible to ``bool`` |``!(a < b)`` | |
|
||||
+--------------------------------+----------------------------------------+----------------------+-----------------------------+
|
||||
|``a <= b`` |convertible to ``bool`` |``!(a > b)`` | |
|
||||
+--------------------------------+----------------------------------------+----------------------+-----------------------------+
|
||||
|``traversal_category<X>::type`` |Convertible to | | |
|
||||
| |``random_access_traversal_iterator_tag``| | |
|
||||
+--------------------------------+----------------------------------------+----------------------+-----------------------------+
|
||||
+----------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
|Random Access Traversal Iterator Requirements (in addition to Bidirectional Traversal Iterator) |
|
||||
+-------------------------------------------+-------------------------------------------------+-------------------------+----------------------+
|
||||
|Expression |Return Type |Operational Semantics |Assertion/ |
|
||||
| | | |Precondition |
|
||||
+===========================================+=================================================+=========================+======================+
|
||||
|``r += n`` |``X&`` |:: | |
|
||||
| | | | |
|
||||
| | | { | |
|
||||
| | | Distance m = n; | |
|
||||
| | | if (m >= 0) | |
|
||||
| | | while (m--) | |
|
||||
| | | ++r; | |
|
||||
| | | else | |
|
||||
| | | while (m++) | |
|
||||
| | | --r; | |
|
||||
| | | return r; | |
|
||||
| | | } | |
|
||||
+-------------------------------------------+-------------------------------------------------+-------------------------+----------------------+
|
||||
|``a + n``, ``n + a`` |``X`` |``{ X tmp = a; return tmp| |
|
||||
| | |+= n; }`` | |
|
||||
| | | | |
|
||||
+-------------------------------------------+-------------------------------------------------+-------------------------+----------------------+
|
||||
|``r -= n`` |``X&`` |``return r += -n`` | |
|
||||
+-------------------------------------------+-------------------------------------------------+-------------------------+----------------------+
|
||||
|``a - n`` |``X`` |``{ X tmp = a; return tmp| |
|
||||
| | |-= n; }`` | |
|
||||
| | | | |
|
||||
+-------------------------------------------+-------------------------------------------------+-------------------------+----------------------+
|
||||
|``b - a`` |``Distance`` |``a < b ? distance(a,b) |pre: there exists a |
|
||||
| | |: -distance(b,a)`` |value ``n`` of |
|
||||
| | | |``Distance`` such that|
|
||||
| | | |``a + n == b``. ``b |
|
||||
| | | |== a + (b - a)``. |
|
||||
+-------------------------------------------+-------------------------------------------------+-------------------------+----------------------+
|
||||
|``a[n]`` |convertible to T |``*(a + n)`` |pre: a is a `readable |
|
||||
| | | |iterator`_ |
|
||||
+-------------------------------------------+-------------------------------------------------+-------------------------+----------------------+
|
||||
|``a[n] = v`` |convertible to T |``*(a + n) = v`` |pre: a is a `writable |
|
||||
| | | |iterator`_ |
|
||||
+-------------------------------------------+-------------------------------------------------+-------------------------+----------------------+
|
||||
|``a < b`` |convertible to ``bool`` |``b - a > 0`` |``<`` is a total |
|
||||
| | | |ordering relation |
|
||||
+-------------------------------------------+-------------------------------------------------+-------------------------+----------------------+
|
||||
|``a > b`` |convertible to ``bool`` |``b < a`` |``>`` is a total |
|
||||
| | | |ordering relation |
|
||||
+-------------------------------------------+-------------------------------------------------+-------------------------+----------------------+
|
||||
|``a >= b`` |convertible to ``bool`` |``!(a < b)`` | |
|
||||
+-------------------------------------------+-------------------------------------------------+-------------------------+----------------------+
|
||||
|``a <= b`` |convertible to ``bool`` |``!(a > b)`` | |
|
||||
+-------------------------------------------+-------------------------------------------------+-------------------------+----------------------+
|
||||
|``traversal_category<X>::type`` |Convertible to | | |
|
||||
| |``random_access_traversal_iterator_tag`` | | |
|
||||
+-------------------------------------------+-------------------------------------------------+-------------------------+----------------------+
|
||||
|
||||
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
<title>Permutation Iterator</title>
|
||||
<meta name="author" content="Toon Knapen, David Abrahams, Roland Richter, Jeremy Siek" />
|
||||
<meta name="organization" content="Boost Consulting, Indiana University Open Systems Lab" />
|
||||
<meta name="date" content="2003-08-05" />
|
||||
<meta name="date" content="2003-09-14" />
|
||||
<meta name="copyright" content="Copyright Toon Knapen, David Abrahams, Roland Richter, and Jeremy Siek 2003. All rights reserved" />
|
||||
<link rel="stylesheet" href="../../../rst.css" type="text/css" />
|
||||
</head>
|
||||
@ -26,7 +26,7 @@
|
||||
<td><a class="first reference" href="http://www.boost-consulting.com">Boost Consulting</a>, Indiana University <a class="last reference" href="http://www.osl.iu.edu">Open Systems
|
||||
Lab</a></td></tr>
|
||||
<tr><th class="docinfo-name">Date:</th>
|
||||
<td>2003-08-05</td></tr>
|
||||
<td>2003-09-14</td></tr>
|
||||
<tr><th class="docinfo-name">Copyright:</th>
|
||||
<td>Copyright Toon Knapen, David Abrahams, Roland Richter, and Jeremy Siek 2003. All rights reserved</td></tr>
|
||||
</tbody>
|
||||
@ -121,7 +121,7 @@ ForwardIterator instead of amortized constant time.</p>
|
||||
<hr class="footer" />
|
||||
<div class="footer">
|
||||
<a class="reference" href="permutation_iterator.rst">View document source</a>.
|
||||
Generated on: 2003-09-14 02:16 UTC.
|
||||
Generated on: 2003-09-21 09:35 UTC.
|
||||
Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
|
||||
</div>
|
||||
</body>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<title>Reverse Iterator</title>
|
||||
<meta name="author" content="David Abrahams, Jeremy Siek, Thomas Witt" />
|
||||
<meta name="organization" content="Boost Consulting, Indiana University Open Systems Lab, University of Hanover Institute for Transport Railway Operation and Construction" />
|
||||
<meta name="date" content="2003-08-05" />
|
||||
<meta name="date" content="2003-09-14" />
|
||||
<meta name="copyright" content="Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved" />
|
||||
<link rel="stylesheet" href="../../../rst.css" type="text/css" />
|
||||
</head>
|
||||
@ -27,7 +27,7 @@
|
||||
Lab</a>, University of Hanover <a class="last reference" href="http://www.ive.uni-hannover.de">Institute for Transport
|
||||
Railway Operation and Construction</a></td></tr>
|
||||
<tr><th class="docinfo-name">Date:</th>
|
||||
<td>2003-08-05</td></tr>
|
||||
<td>2003-09-14</td></tr>
|
||||
<tr><th class="docinfo-name">Copyright:</th>
|
||||
<td>Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved</td></tr>
|
||||
</tbody>
|
||||
@ -136,7 +136,7 @@ reverse_iterator(
|
||||
<hr class="footer" />
|
||||
<div class="footer">
|
||||
<a class="reference" href="reverse_iterator.rst">View document source</a>.
|
||||
Generated on: 2003-09-14 02:16 UTC.
|
||||
Generated on: 2003-09-21 09:35 UTC.
|
||||
Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
|
||||
</div>
|
||||
</body>
|
||||
|
Reference in New Issue
Block a user