mirror of
https://github.com/boostorg/iterator.git
synced 2025-07-29 20:37:17 +02:00
Table formatting tweaks for PDF/tex generation.
Some minor editing for language improvements. [SVN r20151]
This commit is contained in:
@ -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>
|
||||
|
Reference in New Issue
Block a user