mirror of
https://github.com/boostorg/iterator.git
synced 2025-07-29 12:27:33 +02:00
Added iterator_archetype doc.
[SVN r21783]
This commit is contained in:
220
doc/iterator_archetypes.html
Executable file
220
doc/iterator_archetypes.html
Executable file
@ -0,0 +1,220 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<meta name="generator" content="Docutils 0.3.1: http://docutils.sourceforge.net/" />
|
||||||
|
<title>Iterator Archetype</title>
|
||||||
|
<meta name="author" content="David Abrahams, Jeremy Siek, Thomas Witt" />
|
||||||
|
<meta name="organization" content="Boost Consulting, Indiana University Open Systems Lab, Zephyr Associates, Inc." />
|
||||||
|
<meta name="date" content="2004-01-13" />
|
||||||
|
<meta name="copyright" content="Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2004. All rights reserved" />
|
||||||
|
<link rel="stylesheet" href="default.css" type="text/css" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="document" id="iterator-archetype">
|
||||||
|
<h1 class="title">Iterator Archetype</h1>
|
||||||
|
<table class="docinfo" frame="void" rules="none">
|
||||||
|
<col class="docinfo-name" />
|
||||||
|
<col class="docinfo-content" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<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@styleadvisor.com">witt@styleadvisor.com</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>, <a class="last reference" href="http://www.styleadvisor.com">Zephyr Associates, Inc.</a></td></tr>
|
||||||
|
<tr><th class="docinfo-name">Date:</th>
|
||||||
|
<td>2004-01-13</td></tr>
|
||||||
|
<tr><th class="docinfo-name">Copyright:</th>
|
||||||
|
<td>Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2004. All rights reserved</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<table class="field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field"><th class="field-name">abstract:</th><td class="field-body">iterator archetypes provide a means to check the compile time requirements of a generic component on its iterator arguments.</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div class="contents topic" id="table-of-contents">
|
||||||
|
<p class="topic-title"><a name="table-of-contents">Table of Contents</a></p>
|
||||||
|
<ul class="simple">
|
||||||
|
<li><a class="reference" href="#reference" id="id3" name="id3">Reference</a><ul>
|
||||||
|
<li><a class="reference" href="#iterator-archetype-synopsis" id="id4" name="id4"><tt class="literal"><span class="pre">iterator_archetype</span></tt> Synopsis</a></li>
|
||||||
|
<li><a class="reference" href="#access-category-tags" id="id5" name="id5"><tt class="literal"><span class="pre">Access</span> <span class="pre">Category</span> <span class="pre">Tags</span></tt></a></li>
|
||||||
|
<li><a class="reference" href="#iterator-archetype-requirements" id="id6" name="id6"><tt class="literal"><span class="pre">iterator_archetype</span></tt> Requirements</a></li>
|
||||||
|
<li><a class="reference" href="#iterator-archetype-models" id="id7" name="id7"><tt class="literal"><span class="pre">iterator_archetype</span></tt> Models</a></li>
|
||||||
|
<li><a class="reference" href="#traits" id="id8" name="id8"><tt class="literal"><span class="pre">Traits</span></tt></a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="reference">
|
||||||
|
<h1><a class="toc-backref" href="#id3" name="reference">Reference</a></h1>
|
||||||
|
<div class="section" id="iterator-archetype-synopsis">
|
||||||
|
<h2><a class="toc-backref" href="#id4" name="iterator-archetype-synopsis"><tt class="literal"><span class="pre">iterator_archetype</span></tt> Synopsis</a></h2>
|
||||||
|
<pre class="literal-block">
|
||||||
|
namespace iterator_archetypes
|
||||||
|
{
|
||||||
|
// Access categories
|
||||||
|
|
||||||
|
typedef /<em>implementation defined</em>/ readable_iterator_t;
|
||||||
|
typedef /<em>implementation defined</em>/ writable_iterator_t;
|
||||||
|
typedef /<em>implementation defined</em>/ readable_writable_iterator_t;
|
||||||
|
typedef /<em>implementation defined</em>/ readable_lvalue_iterator_t;
|
||||||
|
typedef /<em>implementation defined</em>/ writable_lvalue_iterator_t;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
template <
|
||||||
|
class Value
|
||||||
|
, class AccessCategory
|
||||||
|
, class TraversalCategory
|
||||||
|
>
|
||||||
|
class iterator_archetype
|
||||||
|
{
|
||||||
|
typedef /* see below <em>/ value_type;
|
||||||
|
typedef /</em> see below <em>/ reference;
|
||||||
|
typedef /</em> see below <em>/ pointer;
|
||||||
|
typedef /</em> see below <em>/ difference_type;
|
||||||
|
typedef /</em> see below <a href="#id1" name="id2"><span class="problematic" id="id2">*</span></a>/ iterator_category;
|
||||||
|
};
|
||||||
|
</pre>
|
||||||
|
<div class="system-message" id="id1">
|
||||||
|
<p class="system-message-title">System Message: <a name="id1">WARNING/2</a> (<tt>iterator_archetypes.rst</tt>, line 26); <em><a href="#id2">backlink</a></em></p>
|
||||||
|
Inline emphasis start-string without end-string.</div>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="access-category-tags">
|
||||||
|
<h2><a class="toc-backref" href="#id5" name="access-category-tags"><tt class="literal"><span class="pre">Access</span> <span class="pre">Category</span> <span class="pre">Tags</span></tt></a></h2>
|
||||||
|
<p>The access category types provided correspond to the following
|
||||||
|
standard iterator access concept combinations:</p>
|
||||||
|
<pre class="literal-block">
|
||||||
|
readable_iterator_t :=
|
||||||
|
|
||||||
|
Readable Iterator
|
||||||
|
|
||||||
|
writable_iterator_t :=
|
||||||
|
|
||||||
|
Writeable Iterator
|
||||||
|
|
||||||
|
readable_writable_iterator_t :=
|
||||||
|
|
||||||
|
Readable Iterator & Writeable Iterator & Swappable Iterator
|
||||||
|
|
||||||
|
readable_lvalue_iterator_t :=
|
||||||
|
|
||||||
|
Readable Iterator & Lvalue Iterator
|
||||||
|
|
||||||
|
writeable_lvalue_iterator_t :=
|
||||||
|
|
||||||
|
Readable Iterator & Writeable Iterator & Swappable Iterator & Lvalue Iterator
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="iterator-archetype-requirements">
|
||||||
|
<h2><a class="toc-backref" href="#id6" name="iterator-archetype-requirements"><tt class="literal"><span class="pre">iterator_archetype</span></tt> Requirements</a></h2>
|
||||||
|
<p>The <tt class="literal"><span class="pre">AccessCategory</span></tt> argument must be one of the predefined access
|
||||||
|
category tags. The <tt class="literal"><span class="pre">TraversalCategory</span></tt> must be one of the standard
|
||||||
|
traversal tags. The <tt class="literal"><span class="pre">Value</span></tt> type must satisfy the requirements of
|
||||||
|
the iterator concept specified by <tt class="literal"><span class="pre">AccessCategory</span></tt> and
|
||||||
|
<tt class="literal"><span class="pre">TraversalCategory</span></tt> as implied by the nested traits types.</p>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="iterator-archetype-models">
|
||||||
|
<h2><a class="toc-backref" href="#id7" name="iterator-archetype-models"><tt class="literal"><span class="pre">iterator_archetype</span></tt> Models</a></h2>
|
||||||
|
<p><tt class="literal"><span class="pre">iterator_archetype</span></tt> models the iterator concepts specified by the
|
||||||
|
<tt class="literal"><span class="pre">AccessCategory</span></tt> and <tt class="literal"><span class="pre">TraversalCategory</span></tt>
|
||||||
|
arguments. <tt class="literal"><span class="pre">iterator_archetype</span></tt> does not model any other access
|
||||||
|
concepts or any more derived traversal concepts.</p>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="traits">
|
||||||
|
<h2><a class="toc-backref" href="#id8" name="traits"><tt class="literal"><span class="pre">Traits</span></tt></a></h2>
|
||||||
|
<p>The nested trait types are defined as follows:</p>
|
||||||
|
<pre class="literal-block">
|
||||||
|
if (AccessCategory == readable_iterator_t)
|
||||||
|
|
||||||
|
value_type = Value
|
||||||
|
reference = Value
|
||||||
|
pointer = Value*
|
||||||
|
|
||||||
|
else if (AccessCategory == writable_iterator_t)
|
||||||
|
|
||||||
|
value_type = void
|
||||||
|
reference = void
|
||||||
|
pointer = void
|
||||||
|
|
||||||
|
else if (AccessCategory == readable_writable_iterator_t)
|
||||||
|
|
||||||
|
value_type = Value
|
||||||
|
|
||||||
|
reference :=
|
||||||
|
|
||||||
|
A type X that is convertible to Value for which the following
|
||||||
|
expression is valid. Given an object x of type X and v of type
|
||||||
|
Value.
|
||||||
|
|
||||||
|
x = v
|
||||||
|
|
||||||
|
pointer = Value*
|
||||||
|
|
||||||
|
else if (AccessCategory == readable_lvalue_iterator_t)
|
||||||
|
|
||||||
|
value_type = Value
|
||||||
|
reference = Value const&
|
||||||
|
pointer = Value const*
|
||||||
|
|
||||||
|
else if (AccessCategory == writable_lvalue_iterator_t)
|
||||||
|
|
||||||
|
value_type = Value
|
||||||
|
reference = Value&
|
||||||
|
pointer = Value*
|
||||||
|
|
||||||
|
if ( TraversalCategory is convertible to forward_traversal_tag )
|
||||||
|
|
||||||
|
difference_type := ptrdiff_t
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
difference_type := unspecified type
|
||||||
|
|
||||||
|
|
||||||
|
iterator_category :=
|
||||||
|
|
||||||
|
A type X satisfying the following two constraints:
|
||||||
|
|
||||||
|
1. X is convertible to X1, and not to any more-derived
|
||||||
|
type, where X1 is defined by:
|
||||||
|
|
||||||
|
if (reference is a reference type
|
||||||
|
&& TraversalCategory is convertible to forward_traversal_tag)
|
||||||
|
{
|
||||||
|
if (TraversalCategory is convertible to random_access_traversal_tag)
|
||||||
|
X1 = random_access_iterator_tag
|
||||||
|
else if (TraversalCategory is convertible to bidirectional_traversal_tag)
|
||||||
|
X1 = bidirectional_iterator_tag
|
||||||
|
else
|
||||||
|
X1 = forward_iterator_tag
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (TraversalCategory is convertible to single_pass_traversal_tag
|
||||||
|
&& reference != void)
|
||||||
|
X1 = input_iterator_tag
|
||||||
|
else
|
||||||
|
X1 = output_iterator_tag
|
||||||
|
}
|
||||||
|
|
||||||
|
2. X is convertible to TraversalCategory
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<hr class="footer" />
|
||||||
|
<div class="footer">
|
||||||
|
<a class="reference" href="iterator_archetypes.rst">View document source</a>.
|
||||||
|
Generated on: 2004-01-16 18:30 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>
|
181
doc/iterator_archetypes.rst
Executable file
181
doc/iterator_archetypes.rst
Executable file
@ -0,0 +1,181 @@
|
|||||||
|
++++++++++++++++++++
|
||||||
|
Iterator Archetype
|
||||||
|
++++++++++++++++++++
|
||||||
|
|
||||||
|
:Author: David Abrahams, Jeremy Siek, Thomas Witt
|
||||||
|
:Contact: dave@boost-consulting.com, jsiek@osl.iu.edu, witt@styleadvisor.com
|
||||||
|
:organization: `Boost Consulting`_, Indiana University `Open Systems
|
||||||
|
Lab`_, `Zephyr Associates, Inc.`_
|
||||||
|
:date: $Date$
|
||||||
|
:copyright: Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2004. All rights reserved
|
||||||
|
|
||||||
|
.. _`Boost Consulting`: http://www.boost-consulting.com
|
||||||
|
.. _`Open Systems Lab`: http://www.osl.iu.edu
|
||||||
|
.. _`Zephyr Associates, Inc.`: http://www.styleadvisor.com
|
||||||
|
|
||||||
|
:abstract: iterator archetypes provide a means to check the compile time requirements of a generic component on its iterator arguments.
|
||||||
|
|
||||||
|
.. contents:: Table of Contents
|
||||||
|
|
||||||
|
Reference
|
||||||
|
=========
|
||||||
|
|
||||||
|
``iterator_archetype`` Synopsis
|
||||||
|
...............................
|
||||||
|
|
||||||
|
.. parsed-literal::
|
||||||
|
|
||||||
|
namespace iterator_archetypes
|
||||||
|
{
|
||||||
|
// Access categories
|
||||||
|
|
||||||
|
typedef /*implementation defined*/ readable_iterator_t;
|
||||||
|
typedef /*implementation defined*/ writable_iterator_t;
|
||||||
|
typedef /*implementation defined*/ readable_writable_iterator_t;
|
||||||
|
typedef /*implementation defined*/ readable_lvalue_iterator_t;
|
||||||
|
typedef /*implementation defined*/ writable_lvalue_iterator_t;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
template <
|
||||||
|
class Value
|
||||||
|
, class AccessCategory
|
||||||
|
, class TraversalCategory
|
||||||
|
>
|
||||||
|
class iterator_archetype
|
||||||
|
{
|
||||||
|
typedef /* see below */ value_type;
|
||||||
|
typedef /* see below */ reference;
|
||||||
|
typedef /* see below */ pointer;
|
||||||
|
typedef /* see below */ difference_type;
|
||||||
|
typedef /* see below */ iterator_category;
|
||||||
|
};
|
||||||
|
|
||||||
|
``Access Category Tags``
|
||||||
|
........................
|
||||||
|
|
||||||
|
The access category types provided correspond to the following
|
||||||
|
standard iterator access concept combinations:
|
||||||
|
|
||||||
|
.. parsed-literal::
|
||||||
|
|
||||||
|
readable_iterator_t :=
|
||||||
|
|
||||||
|
Readable Iterator
|
||||||
|
|
||||||
|
writable_iterator_t :=
|
||||||
|
|
||||||
|
Writeable Iterator
|
||||||
|
|
||||||
|
readable_writable_iterator_t :=
|
||||||
|
|
||||||
|
Readable Iterator & Writeable Iterator & Swappable Iterator
|
||||||
|
|
||||||
|
readable_lvalue_iterator_t :=
|
||||||
|
|
||||||
|
Readable Iterator & Lvalue Iterator
|
||||||
|
|
||||||
|
writeable_lvalue_iterator_t :=
|
||||||
|
|
||||||
|
Readable Iterator & Writeable Iterator & Swappable Iterator & Lvalue Iterator
|
||||||
|
|
||||||
|
``iterator_archetype`` Requirements
|
||||||
|
...................................
|
||||||
|
|
||||||
|
The ``AccessCategory`` argument must be one of the predefined access
|
||||||
|
category tags. The ``TraversalCategory`` must be one of the standard
|
||||||
|
traversal tags. The ``Value`` type must satisfy the requirements of
|
||||||
|
the iterator concept specified by ``AccessCategory`` and
|
||||||
|
``TraversalCategory`` as implied by the nested traits types.
|
||||||
|
|
||||||
|
``iterator_archetype`` Models
|
||||||
|
.............................
|
||||||
|
|
||||||
|
``iterator_archetype`` models the iterator concepts specified by the
|
||||||
|
``AccessCategory`` and ``TraversalCategory``
|
||||||
|
arguments. ``iterator_archetype`` does not model any other access
|
||||||
|
concepts or any more derived traversal concepts.
|
||||||
|
|
||||||
|
``Traits``
|
||||||
|
..........
|
||||||
|
|
||||||
|
The nested trait types are defined as follows:
|
||||||
|
|
||||||
|
.. parsed-literal::
|
||||||
|
|
||||||
|
if (AccessCategory == readable_iterator_t)
|
||||||
|
|
||||||
|
value_type = Value
|
||||||
|
reference = Value
|
||||||
|
pointer = Value*
|
||||||
|
|
||||||
|
else if (AccessCategory == writable_iterator_t)
|
||||||
|
|
||||||
|
value_type = void
|
||||||
|
reference = void
|
||||||
|
pointer = void
|
||||||
|
|
||||||
|
else if (AccessCategory == readable_writable_iterator_t)
|
||||||
|
|
||||||
|
value_type = Value
|
||||||
|
|
||||||
|
reference :=
|
||||||
|
|
||||||
|
A type X that is convertible to Value for which the following
|
||||||
|
expression is valid. Given an object x of type X and v of type
|
||||||
|
Value.
|
||||||
|
|
||||||
|
x = v
|
||||||
|
|
||||||
|
pointer = Value*
|
||||||
|
|
||||||
|
else if (AccessCategory == readable_lvalue_iterator_t)
|
||||||
|
|
||||||
|
value_type = Value
|
||||||
|
reference = Value const&
|
||||||
|
pointer = Value const*
|
||||||
|
|
||||||
|
else if (AccessCategory == writable_lvalue_iterator_t)
|
||||||
|
|
||||||
|
value_type = Value
|
||||||
|
reference = Value&
|
||||||
|
pointer = Value*
|
||||||
|
|
||||||
|
if ( TraversalCategory is convertible to forward_traversal_tag )
|
||||||
|
|
||||||
|
difference_type := ptrdiff_t
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
difference_type := unspecified type
|
||||||
|
|
||||||
|
|
||||||
|
iterator_category :=
|
||||||
|
|
||||||
|
A type X satisfying the following two constraints:
|
||||||
|
|
||||||
|
1. X is convertible to X1, and not to any more-derived
|
||||||
|
type, where X1 is defined by:
|
||||||
|
|
||||||
|
if (reference is a reference type
|
||||||
|
&& TraversalCategory is convertible to forward_traversal_tag)
|
||||||
|
{
|
||||||
|
if (TraversalCategory is convertible to random_access_traversal_tag)
|
||||||
|
X1 = random_access_iterator_tag
|
||||||
|
else if (TraversalCategory is convertible to bidirectional_traversal_tag)
|
||||||
|
X1 = bidirectional_iterator_tag
|
||||||
|
else
|
||||||
|
X1 = forward_iterator_tag
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (TraversalCategory is convertible to single_pass_traversal_tag
|
||||||
|
&& reference != void)
|
||||||
|
X1 = input_iterator_tag
|
||||||
|
else
|
||||||
|
X1 = output_iterator_tag
|
||||||
|
}
|
||||||
|
|
||||||
|
2. X is convertible to TraversalCategory
|
||||||
|
|
||||||
|
|
Reference in New Issue
Block a user