More progress on indirect_iterator

[SVN r21720]
This commit is contained in:
Dave Abrahams 2004-01-14 04:16:27 +00:00
parent 5f3b97ceff
commit dd50d3f2ab
8 changed files with 126 additions and 89 deletions

View File

@ -12,6 +12,7 @@ MV = /bin/mv
EGREP = /bin/egrep
ECHO = /bin/echo
PERL = /usr/bin/perl
PYTHON = python
CAT = /bin/cat
TOUCH = /bin/touch
ZIP = /usr/bin/zip
@ -48,7 +49,7 @@ PRINTZIP = prints.zip
SLIDEZIP = slides.zip
# ... Depend
DEPENDFILES = .depend .depend-rst
DEPENDFILES = .depend
GENFILE = .generated
# ... List of extensions and files generated
@ -211,26 +212,21 @@ clean:
${RMRF} ${generated}
# ... Target: create dependencies
depend: .depend-rst
depend: .depend
# ... Target: dependency file (parse TEXFILES for multiinclude and includegraphics)
.depend: GNUmakefile ${TEXFILES}
${RMRF} $@
@for t in ${TEXSTEMS} ; do \
${ECHO} "Scanning $$t.tex"; \
${PERL} -e 'my $$target = shift @ARGV;' -e 'while (<>) { /\\multiinclude(\[.*?\])?{(.*?)}/ && print "$$target: $$2.0\n";}' $$t.pdf < $$t.tex >> $@; \
${PERL} -e 'my $$target = shift @ARGV;' -e 'while (<>) { /\\includegraphics(\[.*?\])?{(.*?)\.(.*?)}/ && print "$$target: $$2.$$3\n";}' $$t.pdf < $$t.tex >> $@; \
done
# .depend: GNUmakefile ${TEXFILES}
# ${RMRF} $@
# @for t in ${TEXSTEMS} ; do \
# ${ECHO} "Scanning $$t.tex"; \
# ${PERL} -e 'my $$target = shift @ARGV;' -e 'while (<>) { /\\multiinclude(\[.*?\])?{(.*?)}/ && print "$$target: $$2.0\n";}' $$t.pdf < $$t.tex >> $@; \
# ${PERL} -e 'my $$target = shift @ARGV;' -e 'while (<>) { /\\includegraphics(\[.*?\])?{(.*?)\.(.*?)}/ && print "$$target: $$2.$$3\n";}' $$t.pdf < $$t.tex >> $@; \
# done
.depend-rst: GNUmakefile ${RSTFILES}
.depend: GNUmakefile ${RSTFILES}
${RMRF} $@
@for t in ${RSTSTEMS} ; do \
${ECHO} "Scanning $$t.rst"; \
${PERL} -e 'my $$target = shift @ARGV;' -e 'while (<>) { /^\.\. (include|image)::\s+(.*)/ && print "$$target: $$2\n";}' $$t.html < $$t.rst >> $@; \
${PERL} -e 'my $$target = shift @ARGV;' -e 'while (<>) { /^\.\. (include|image)::\s+(.*)/ && print "$$target: $$2\n";}' $$t.tex < $$t.rst >> $@; \
done
${PYTHON} scanrst.py ${RSTFILES} > $@
# ... include dependency files
# -include .depend
-include .depend-rst
-include .depend

View File

@ -1415,7 +1415,7 @@ else
<tt class="literal"><span class="pre">R</span></tt> is <tt class="literal"><span class="pre">reference</span></tt> and <tt class="literal"><span class="pre">V</span></tt> is <tt class="literal"><span class="pre">value_type</span></tt>, and where: if
<tt class="literal"><span class="pre">CategoryOrTraversal</span></tt> is <tt class="literal"><span class="pre">use_default</span></tt>, <tt class="literal"><span class="pre">C</span></tt> is
<tt class="literal"><span class="pre">iterator_traversal&lt;Iterator&gt;::type</span></tt> and otherwise <tt class="literal"><span class="pre">C</span></tt> is
<tt class="literal"><span class="pre">CategoryOrTraversal</span></tt>:</p>
<tt class="literal"><span class="pre">CategoryOrTraversal</span></tt>.</p>
<blockquote>
<ul>
<li><p class="first">if <tt class="literal"><span class="pre">C</span></tt> is convertible to <tt class="literal"><span class="pre">std::input_iterator_tag</span></tt> or
@ -1465,38 +1465,42 @@ convertible, and not to any more-derived traversal tag type.</p>
</div>
<div class="section" id="indirect-iterator-requirements">
<h4><a class="toc-backref" href="#id45" name="indirect-iterator-requirements"><tt class="literal"><span class="pre">indirect_iterator</span></tt> requirements</a></h4>
<p><tt class="literal"><span class="pre">CategoryOrTraversal</span></tt> argument shall be <tt class="literal"><span class="pre">use_default</span></tt> or it
shall be convertible to one of the standard iterator or traversal
tags. If <tt class="literal"><span class="pre">CategoryOrTraversal</span></tt> is not <tt class="literal"><span class="pre">use_default</span></tt>, it shall
indicate the traversal category modeled by <tt class="literal"><span class="pre">Iterator</span></tt>. If</p>
<p>The expression <tt class="literal"><span class="pre">*v</span></tt>, where <tt class="literal"><span class="pre">v</span></tt> is an object of type
<p>The expression <tt class="literal"><span class="pre">*v</span></tt>, where <tt class="literal"><span class="pre">v</span></tt> is an object of
<tt class="literal"><span class="pre">iterator_traits&lt;Iterator&gt;::value_type</span></tt>, shall be valid
expression and convertible to <tt class="literal"><span class="pre">reference</span></tt>. Also
<tt class="literal"><span class="pre">indirect_iterator::reference</span></tt> must be convertible to
<tt class="literal"><span class="pre">indirect_iterator::value</span></tt>. There are further requirements on
the <tt class="literal"><span class="pre">iterator_traits&lt;Iterator&gt;::value_type</span></tt> if the <tt class="literal"><span class="pre">Value</span></tt>
expression and convertible to <tt class="literal"><span class="pre">reference</span></tt>. <tt class="literal"><span class="pre">Iterator</span></tt> shall
model the traversal concept indicated by <tt class="literal"><span class="pre">iterator_category</span></tt>.
<tt class="literal"><span class="pre">Value</span></tt>, <tt class="literal"><span class="pre">Reference</span></tt>, and <tt class="literal"><span class="pre">Difference</span></tt> shall be chosen so
that <tt class="literal"><span class="pre">value_type</span></tt>, <tt class="literal"><span class="pre">reference</span></tt>, and <tt class="literal"><span class="pre">difference_type</span></tt> meet
the requirements indicated by <tt class="literal"><span class="pre">iterator_category</span></tt>.</p>
<p>[Note: there are further requirements on the
<tt class="literal"><span class="pre">iterator_traits&lt;Iterator&gt;::value_type</span></tt> if the <tt class="literal"><span class="pre">Value</span></tt>
parameter is not <tt class="literal"><span class="pre">use_default</span></tt>, as implied by the algorithm for
deducing the default for the <tt class="literal"><span class="pre">value_type</span></tt> member.</p>
deducing the default for the <tt class="literal"><span class="pre">value_type</span></tt> member.]</p>
</div>
<div class="section" id="indirect-iterator-models">
<h4><a class="toc-backref" href="#id46" name="indirect-iterator-models"><tt class="literal"><span class="pre">indirect_iterator</span></tt> models</a></h4>
<p>If <tt class="literal"><span class="pre">CategoryOrTraversal</span></tt> is a standard iterator tag,
<tt class="literal"><span class="pre">indirect_iterator</span></tt> is a model of the iterator concept corresponding
to the tag, otherwise <tt class="literal"><span class="pre">indirect_iterator</span></tt> satisfies the requirements
of the most refined standard traversal concept that is satisfied by
the <tt class="literal"><span class="pre">Iterator</span></tt> argument.</p>
<p><tt class="literal"><span class="pre">indirect_iterator</span></tt> models Readable Iterator. If
<tt class="literal"><span class="pre">indirect_iterator::reference(*v)</span> <span class="pre">=</span> <span class="pre">t</span></tt> is a valid expression (where
<tt class="literal"><span class="pre">t</span></tt> is an object of type <tt class="literal"><span class="pre">indirect_iterator::value_type</span></tt>) then
<tt class="literal"><span class="pre">indirect_iterator</span></tt> models Writable Iterator. If
<tt class="literal"><span class="pre">indirect_iterator::reference</span></tt> is a reference then
<tt class="literal"><span class="pre">indirect_iterator</span></tt> models Lvalue Iterator.</p>
<p>In addition to the concepts indicated by <tt class="literal"><span class="pre">iterator_category</span></tt>, a
specialization of <tt class="literal"><span class="pre">indirect_iterator</span></tt> models the following
concepts, Where <tt class="literal"><span class="pre">v</span></tt> is an object of
<tt class="literal"><span class="pre">iterator_traits&lt;Iterator&gt;::value_type</span></tt>:</p>
<blockquote>
<ul class="simple">
<li>Readable Iterator if <tt class="literal"><span class="pre">reference(*v)</span></tt> is convertible to
<tt class="literal"><span class="pre">value_type</span></tt>.</li>
<li>Writable Iterator if <tt class="literal"><span class="pre">reference(*v)</span> <span class="pre">=</span> <span class="pre">t</span></tt> is a valid
expression (where <tt class="literal"><span class="pre">t</span></tt> is an object of type
<tt class="literal"><span class="pre">indirect_iterator::value_type</span></tt>)</li>
<li>Lvalue Iterator if <tt class="literal"><span class="pre">reference</span></tt> is a reference type.</li>
</ul>
</blockquote>
<p>Two specializations of <tt class="literal"><span class="pre">indirect_iterator</span></tt> are interoperable if
their <tt class="literal"><span class="pre">Iterator</span></tt> parameters are interoperable.</p>
</div>
<div class="section" id="indirect-iterator-operations">
<h4><a class="toc-backref" href="#id47" name="indirect-iterator-operations"><tt class="literal"><span class="pre">indirect_iterator</span></tt> operations</a></h4>
<p>In addition to the operations required by the concepts modeled by
<tt class="literal"><span class="pre">indirect_iterator</span></tt>, <tt class="literal"><span class="pre">indirect_iterator</span></tt> provides the following
operations.</p>
<p>In addition to the operations required by the concepts described
above, specializations of <tt class="literal"><span class="pre">indirect_iterator</span></tt> provide the
following operations.</p>
<p><tt class="literal"><span class="pre">indirect_iterator();</span></tt></p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />

View File

@ -129,7 +129,7 @@ else
<tt class="literal"><span class="pre">R</span></tt> is <tt class="literal"><span class="pre">reference</span></tt> and <tt class="literal"><span class="pre">V</span></tt> is <tt class="literal"><span class="pre">value_type</span></tt>, and where: if
<tt class="literal"><span class="pre">CategoryOrTraversal</span></tt> is <tt class="literal"><span class="pre">use_default</span></tt>, <tt class="literal"><span class="pre">C</span></tt> is
<tt class="literal"><span class="pre">iterator_traversal&lt;Iterator&gt;::type</span></tt> and otherwise <tt class="literal"><span class="pre">C</span></tt> is
<tt class="literal"><span class="pre">CategoryOrTraversal</span></tt>:</p>
<tt class="literal"><span class="pre">CategoryOrTraversal</span></tt>.</p>
<blockquote>
<ul>
<li><p class="first">if <tt class="literal"><span class="pre">C</span></tt> is convertible to <tt class="literal"><span class="pre">std::input_iterator_tag</span></tt> or
@ -179,38 +179,42 @@ convertible, and not to any more-derived traversal tag type.</p>
</div>
<div class="section" id="indirect-iterator-requirements">
<h1><a class="toc-backref" href="#id3" name="indirect-iterator-requirements"><tt class="literal"><span class="pre">indirect_iterator</span></tt> requirements</a></h1>
<p><tt class="literal"><span class="pre">CategoryOrTraversal</span></tt> argument shall be <tt class="literal"><span class="pre">use_default</span></tt> or it
shall be convertible to one of the standard iterator or traversal
tags. If <tt class="literal"><span class="pre">CategoryOrTraversal</span></tt> is not <tt class="literal"><span class="pre">use_default</span></tt>, it shall
indicate the traversal category modeled by <tt class="literal"><span class="pre">Iterator</span></tt>. If</p>
<p>The expression <tt class="literal"><span class="pre">*v</span></tt>, where <tt class="literal"><span class="pre">v</span></tt> is an object of type
<p>The expression <tt class="literal"><span class="pre">*v</span></tt>, where <tt class="literal"><span class="pre">v</span></tt> is an object of
<tt class="literal"><span class="pre">iterator_traits&lt;Iterator&gt;::value_type</span></tt>, shall be valid
expression and convertible to <tt class="literal"><span class="pre">reference</span></tt>. Also
<tt class="literal"><span class="pre">indirect_iterator::reference</span></tt> must be convertible to
<tt class="literal"><span class="pre">indirect_iterator::value</span></tt>. There are further requirements on
the <tt class="literal"><span class="pre">iterator_traits&lt;Iterator&gt;::value_type</span></tt> if the <tt class="literal"><span class="pre">Value</span></tt>
expression and convertible to <tt class="literal"><span class="pre">reference</span></tt>. <tt class="literal"><span class="pre">Iterator</span></tt> shall
model the traversal concept indicated by <tt class="literal"><span class="pre">iterator_category</span></tt>.
<tt class="literal"><span class="pre">Value</span></tt>, <tt class="literal"><span class="pre">Reference</span></tt>, and <tt class="literal"><span class="pre">Difference</span></tt> shall be chosen so
that <tt class="literal"><span class="pre">value_type</span></tt>, <tt class="literal"><span class="pre">reference</span></tt>, and <tt class="literal"><span class="pre">difference_type</span></tt> meet
the requirements indicated by <tt class="literal"><span class="pre">iterator_category</span></tt>.</p>
<p>[Note: there are further requirements on the
<tt class="literal"><span class="pre">iterator_traits&lt;Iterator&gt;::value_type</span></tt> if the <tt class="literal"><span class="pre">Value</span></tt>
parameter is not <tt class="literal"><span class="pre">use_default</span></tt>, as implied by the algorithm for
deducing the default for the <tt class="literal"><span class="pre">value_type</span></tt> member.</p>
deducing the default for the <tt class="literal"><span class="pre">value_type</span></tt> member.]</p>
</div>
<div class="section" id="indirect-iterator-models">
<h1><a class="toc-backref" href="#id4" name="indirect-iterator-models"><tt class="literal"><span class="pre">indirect_iterator</span></tt> models</a></h1>
<p>If <tt class="literal"><span class="pre">CategoryOrTraversal</span></tt> is a standard iterator tag,
<tt class="literal"><span class="pre">indirect_iterator</span></tt> is a model of the iterator concept corresponding
to the tag, otherwise <tt class="literal"><span class="pre">indirect_iterator</span></tt> satisfies the requirements
of the most refined standard traversal concept that is satisfied by
the <tt class="literal"><span class="pre">Iterator</span></tt> argument.</p>
<p><tt class="literal"><span class="pre">indirect_iterator</span></tt> models Readable Iterator. If
<tt class="literal"><span class="pre">indirect_iterator::reference(*v)</span> <span class="pre">=</span> <span class="pre">t</span></tt> is a valid expression (where
<tt class="literal"><span class="pre">t</span></tt> is an object of type <tt class="literal"><span class="pre">indirect_iterator::value_type</span></tt>) then
<tt class="literal"><span class="pre">indirect_iterator</span></tt> models Writable Iterator. If
<tt class="literal"><span class="pre">indirect_iterator::reference</span></tt> is a reference then
<tt class="literal"><span class="pre">indirect_iterator</span></tt> models Lvalue Iterator.</p>
<p>In addition to the concepts indicated by <tt class="literal"><span class="pre">iterator_category</span></tt>, a
specialization of <tt class="literal"><span class="pre">indirect_iterator</span></tt> models the following
concepts, Where <tt class="literal"><span class="pre">v</span></tt> is an object of
<tt class="literal"><span class="pre">iterator_traits&lt;Iterator&gt;::value_type</span></tt>:</p>
<blockquote>
<ul class="simple">
<li>Readable Iterator if <tt class="literal"><span class="pre">reference(*v)</span></tt> is convertible to
<tt class="literal"><span class="pre">value_type</span></tt>.</li>
<li>Writable Iterator if <tt class="literal"><span class="pre">reference(*v)</span> <span class="pre">=</span> <span class="pre">t</span></tt> is a valid
expression (where <tt class="literal"><span class="pre">t</span></tt> is an object of type
<tt class="literal"><span class="pre">indirect_iterator::value_type</span></tt>)</li>
<li>Lvalue Iterator if <tt class="literal"><span class="pre">reference</span></tt> is a reference type.</li>
</ul>
</blockquote>
<p>Two specializations of <tt class="literal"><span class="pre">indirect_iterator</span></tt> are interoperable if
their <tt class="literal"><span class="pre">Iterator</span></tt> parameters are interoperable.</p>
</div>
<div class="section" id="indirect-iterator-operations">
<h1><a class="toc-backref" href="#id5" name="indirect-iterator-operations"><tt class="literal"><span class="pre">indirect_iterator</span></tt> operations</a></h1>
<p>In addition to the operations required by the concepts modeled by
<tt class="literal"><span class="pre">indirect_iterator</span></tt>, <tt class="literal"><span class="pre">indirect_iterator</span></tt> provides the following
operations.</p>
<p>In addition to the operations required by the concepts described
above, specializations of <tt class="literal"><span class="pre">indirect_iterator</span></tt> provide the
following operations.</p>
<p><tt class="literal"><span class="pre">indirect_iterator();</span></tt></p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />

View File

@ -70,45 +70,52 @@ following pseudo-code. We use the abbreviation
``R`` is ``reference`` and ``V`` is ``value_type``, and where: if
``CategoryOrTraversal`` is ``use_default``, ``C`` is
``iterator_traversal<Iterator>::type`` and otherwise ``C`` is
``CategoryOrTraversal``:
``CategoryOrTraversal``.
.. include:: facade_iterator_category.rst
``indirect_iterator`` requirements
..................................
The expression ``*v``, where ``v`` is an object of type
The expression ``*v``, where ``v`` is an object of
``iterator_traits<Iterator>::value_type``, shall be valid
expression and convertible to ``reference``. [Note: there are
further requirements on the
expression and convertible to ``reference``. ``Iterator`` shall
model the traversal concept indicated by ``iterator_category``.
``Value``, ``Reference``, and ``Difference`` shall be chosen so
that ``value_type``, ``reference``, and ``difference_type`` meet
the requirements indicated by ``iterator_category``.
[Note: there are further requirements on the
``iterator_traits<Iterator>::value_type`` if the ``Value``
parameter is not ``use_default``, as implied by the algorithm for
deducing the default for the ``value_type`` member.]
``indirect_iterator`` models
............................
If ``CategoryOrTraversal`` is a standard iterator tag,
``indirect_iterator`` is a model of the iterator concept
corresponding to the tag. Otherwise, ``indirect_iterator``
satisfies the requirements of the most refined standard traversal
concept that is satisfied by the ``Iterator`` argument.
In addition to the concepts indicated by ``iterator_category``, a
specialization of ``indirect_iterator`` models the following
concepts, Where ``v`` is an object of
``iterator_traits<Iterator>::value_type``:
``indirect_iterator`` models Readable Iterator. If
``indirect_iterator::reference(*v) = t`` is a valid expression (where
``t`` is an object of type ``indirect_iterator::value_type``) then
``indirect_iterator`` models Writable Iterator. If
``indirect_iterator::reference`` is a reference then
``indirect_iterator`` models Lvalue Iterator.
* Readable Iterator if ``reference(*v)`` is convertible to
``value_type``.
* Writable Iterator if ``reference(*v) = t`` is a valid
expression (where ``t`` is an object of type
``indirect_iterator::value_type``)
* Lvalue Iterator if ``reference`` is a reference type.
Two specializations of ``indirect_iterator`` are interoperable if
their ``Iterator`` parameters are interoperable.
``indirect_iterator`` operations
................................
In addition to the operations required by the concepts modeled by
``indirect_iterator``, ``indirect_iterator`` provides the following
operations.
In addition to the operations required by the concepts described
above, specializations of ``indirect_iterator`` provide the
following operations.
``indirect_iterator();``

View File

@ -1024,7 +1024,6 @@ LocalWords: TraversalTag typename lvalues DWA Hmm JGS mis enum -->
<hr class="footer" />
<div class="footer">
<a class="reference" href="new-iter-concepts.rst">View document source</a>.
Generated on: 2004-01-13.
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>

View File

@ -288,7 +288,6 @@ Iterate backward with stride 2 : 6 8
<hr class="footer" />
<div class="footer">
<a class="reference" href="permutation_iterator.rst">View document source</a>.
Generated on: 2004-01-13.
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>

View File

@ -173,7 +173,6 @@ else
<hr class="footer" />
<div class="footer">
<a class="reference" href="pointee.rst">View document source</a>.
Generated on: 2004-01-13.
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>

29
doc/scanrst.py Normal file
View File

@ -0,0 +1,29 @@
# Copyright David Abrahams 2004. Use, modification and distribution is
# subject to the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
# This script accepts a list of .rst files to be processed and
# generates Makefile dependencies for .html and .rst files to stdout.
import os,sys
import re
include = re.compile(r' *\.\. +(include|image):: +(.*)', re.MULTILINE)
def deps(path, found):
dir = os.path.split(path)[0]
for m in re.findall(include, open(path).read()):
dependency = os.path.normpath(os.path.join(dir,m[1]))
if dependency not in found:
found[dependency] = 1
if m[0] == 'include':
deps(dependency, found)
return found
for file in sys.argv[1:]:
found = deps(file, {})
if found:
base = os.path.splitext(os.path.basename(file))[0]
print '%s.tex %s.html: %s' % (base, base, ' '.join(found.keys()))