A few fixes

[SVN r23542]
This commit is contained in:
Dave Abrahams
2004-07-14 12:33:36 +00:00
parent 539add7de6
commit 2241bb1ae3
23 changed files with 424 additions and 182 deletions

View File

@ -1,11 +1,233 @@
# GNUmakefile for postprocessing PDF files
#
# <20> 2000 IBM Corporation.
# Licensed under the GNU GPL.
########################################################################
# Make sure that the following macros are correct for your setup
########################################################################
# ... System utilities
RMRF = /bin/rm -rf
MV = /bin/mv
EGREP = /bin/egrep
ECHO = /bin/echo ECHO = /bin/echo
PERL = /usr/bin/perl
PYTHON = python
CAT = /bin/cat
TOUCH = /bin/touch
ZIP = /usr/bin/zip
all: # ... TeX & postprocessors
@${ECHO} "<boost-root>/libs/iterator/doc/GNUmakefile should be replaced by" PPOWER4 = ppower4
@${ECHO} PDFLATEX = pdflatex
@${ECHO} " http://www.boost-consulting.com/writing/GNUmakefile," METAPOST = mpost
@${ECHO} FIG2DEV = fig2dev
@${ECHO} "before proceeding. That file is not included in the Boost" BIBTEX = bibtex
@${ECHO} "distribution because it is licensed under the GPL, which violates" FOLIAGECUTTER = foliageCutter --verbose
@${ECHO} "Boost license requirements." RST2LATEX = rst2latex
RST2HTML = rst2html
TEX = latex
export TEX
########################################################################
# End of user servicable parts; don't fiddle with the remainder of this
# makefile unless you know what you do.
#
# You have been warned ;=)
########################################################################
# ... Variables
TEXFILES = $(strip $(wildcard *.tex))
RSTFILES = $(strip $(wildcard *.rst))
-include GNUmakefile.local
TEXSTEMS = $(strip $(patsubst %.tex,%,${TEXFILES}))
RSTSTEMS = $(strip $(patsubst %.rst,%,${RSTFILES}))
CUTFOILS = $(strip $(patsubst %,%---toc.tex,${TEXSTEMS}))
PDFFILES = $(strip $(patsubst %.tex,%.pdf,${TEXFILES}))
PRINTS = $(patsubst %.pdf,%-print.pdf,${PDFFILES})
PRINTZIP = prints.zip
SLIDEZIP = slides.zip
# ... Depend
DEPENDFILES = .depend
GENFILE = .generated
# ... List of extensions and files generated
texcrap = *.mpx *.log *.aux *.blg *-print.brf *-print.tex *.out
mpxcrap = mpxerr.tex mpxerr.pdf
generated = *.out *.[0-9] *.[0-9][0-9] *.bbl *.brf \
*.mp *.mmp *.pdf *.ps TMP-*.pdf *.ftoc\
${PRINTZIP} ${SLIDEZIP} ${GENFILE} ${DEPENDFILES} \
${texcrap} ${mpxcrap} ${CUTFOILS} $(strip $(wildcard *---*.tex))
# ... canned command to run PDFLaTeX
define run-pdflatex
@${ECHO} ""
@${ECHO} "---- Running PDFLaTeX on $<" && ${PDFLATEX} $<
@${ECHO} "---- Running PDFLaTeX on $< again" && ${PDFLATEX} $<
-@(${EGREP} -qi 'Rerun to get' $*.log && \
${ECHO} "---- Rerunning PDFLaTeX on $* to get cross-refs right" && \
${PDFLATEX} $<) || \
${ECHO} "---- No cross-refs correcting PDFLaTeX rerun required for $*"
-@(${EGREP} -qi $*.ftoc $*.log && \
${ECHO} "---- Rerunning PDFLaTeX on $* for FTOC" && \
${PDFLATEX} $<) || \
${ECHO} "---- No FTOC PDFLaTeX run required for $*"
-@(${EGREP} -qi 'Warning: Citation' $*.log && \
${ECHO} "---- Running BIBTeX on $*" && \
${BIBTEX} $* && \
${ECHO} "---- Running PDFLaTeX on $<" && \
${PDFLATEX} $<) || \
${ECHO} "---- No BIBTeX run required for $*"
-@(${EGREP} -qi 'Warning: .+undefined references' $*.log && \
${ECHO} "---- Running PDFLaTeX on $<" && \
${PDFLATEX} $<) || \
${ECHO} "---- No further PDFLaTex run required for $<"
@${ECHO} "Generated: $@ {$<}" >> ${GENFILE}
@${RMRF} ${texcrap}
endef
# ... canned command to run PDFLaTeX for printable versions
define run-pdflatex-for-print
@${ECHO} ""
@${ECHO} "---- Running PDFLaTeX on $*-print.tex" && ${PDFLATEX} $*-print.tex
@${ECHO} "---- Running PDFLaTeX on $< again" && ${PDFLATEX} $<
-@(${EGREP} -qi 'Warning: Citation' $*-print.log && \
${ECHO} "---- Running BIBTeX on $*-print" && \
${BIBTEX} $*-print && \
${ECHO} "---- Running PDFLaTeX on $*-print.tex" && \
${PDFLATEX} $*-print.tex) || \
${ECHO} "---- No BIBTeX run required for $*"
-@(${EGREP} -qi 'Warning: .+undefined references' $*-print.log && \
${ECHO} "---- Running PDFLaTeX on $*-print" && \
${PDFLATEX} $*-print.tex) || \
${ECHO} "---- No further PDFLaTex run required for $*-print"
@${ECHO} "Generated: $@ {$<}" >> ${GENFILE}
@${RMRF} ${texcrap}
endef
# DWA begin modifications
# ... Rule: How to generate TeX from ReST
%.tex: %.txt
@${ECHO} "---- Running rst2latex on $<"
${RST2LATEX} $< $@
@${ECHO} "Generated: $@ {$<}" >> ${GENFILE}
# ... Rule: How to generate TeX from ReST
%.tex: %.rst
@${ECHO} "---- Running rst2latex on $<"
${RST2LATEX} $< $@
@${ECHO} "Generated: $@ {$<}" >> ${GENFILE}
# ... Rule: How to generate HTML from ReST
%.html: %.txt
@${ECHO} "---- Running rst2html on $<"
${RST2HTML} $< $@
@${ECHO} "Generated: $@ {$<}" >> ${GENFILE}
# ... Rule: How to generate HTML from ReST
%.html: %.rst
@${ECHO} "---- Running rst2html on $<"
${RST2HTML} $< $@
@${ECHO} "Generated: $@ {$<}" >> ${GENFILE}
# DWA end modifications
# ... Rule: How to generate PDF from TeX
%.pdf: %.tex
$(run-pdflatex)
@${MV} $@ TMP-$@
@${ECHO} "---- Running PPower4 on $*"
${PPOWER4} -v TMP-$@ $@
@${RMRF} TMP-$@
@${ECHO} "Postprocessed: $*.pdf {$*.pdf}" >> ${GENFILE}
# ... Rule: How to generate printable PDF from TeX
%-print.pdf: %.tex
${PERL} -pe 's/^\\documentclass\[(.*?)\]/\\documentclass\[$$1,prints\]/;' < $< > $*-print.tex
$(run-pdflatex-for-print)
@${ECHO} "Generated: $*-print.pdf {$*.pdf}" >> ${GENFILE}
# ... Rule: How to generate cut foils from TeX master
%---toc.tex: %.tex
${FOLIAGECUTTER} --prefix=$* $<
# ... Rule: How to generate MetaPost from FIG
%.mp: %.fig
@${ECHO} "---- Running Fig2Dev (mp) on $<"
${FIG2DEV} -L mp $< $@
@${ECHO} "Generated: $@ {$<}" >> ${GENFILE}
# ... Rule: How to generate MultiMetaPost from FIG
%.mmp: %.fig
@${ECHO} "---- Running Fig2Dev (mmp) on $<"
${FIG2DEV} -L mmp $< $@
@${ECHO} "Generated: $@ {$<}" >> ${GENFILE}
# ... Rule: How to generate includable PS from FIG via MetaPost
%.mps: %.fig
@${ECHO} "---- Running Fig2Dev (mps) on $<"
${FIG2DEV} -L mp $< $*.mps.mp
@${RMRF} $*.mps.[0-9]
${METAPOST} $*.mps.mp
@${MV} $*.mps.0 $@
@${ECHO} "Generated: $@ {$<}" >> ${GENFILE}
# ... Rule: How to generate includable PS files from MultiMetaPost
%.0: %.mmp
@${ECHO} "---- Running MetaPost on $<"
@${RMRF} $*.[0-9] $*.[0-9][0-9]
${METAPOST} $<
@${ECHO} "Generated: $*.0{...} {$<}" >> ${GENFILE}
cleanup-crap:
@${RMRF} ${mpxcrap}
# ... Target: all
all: cleanup-crap ${DEPENDFILES} ${PDFFILES} ${PRINTS} ${PRINTZIP} ${SLIDEZIP}
@${ECHO} ""
@${TOUCH} ${GENFILE}
@${CAT} ${GENFILE}
@${RMRF} ${GENFILE}
# ... Target: ZIP files
zip zips: ${PRINTZIP} ${SLIDEZIP}
# ... Target: ZIP file containing printable versions of slides
${PRINTZIP}: .depend ${PDFFILES}
@${RMRF} ${PRINTZIP}
${ZIP} -r ${PRINTZIP} ${PRINTS}
@${ECHO} "Generated: ${PRINTZIP}" >> ${GENFILE}
# ... Target: ZIP file containing screen versions of slides
${SLIDEZIP}: .depend ${PDFFILES}
@${RMRF} ${SLIDEZIP}
${ZIP} -r ${SLIDEZIP} ${PDFFILES}
@${ECHO} "Generated: ${SLIDEZIP}" >> ${GENFILE}
# ... Target: clean up
clean:
${RMRF} ${generated}
# ... Target: create dependencies
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 ${RSTFILES}
${RMRF} $@
${PYTHON} scanrst.py ${RSTFILES} > $@
# ... include dependency files
# -include .depend
-include .depend

Binary file not shown.

View File

@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.3.1: http://docutils.sourceforge.net/" /> <meta name="generator" content="Docutils 0.3.4: http://docutils.sourceforge.net/" />
<title>Iterator Facade and Adaptor</title> <title>Iterator Facade and Adaptor</title>
<meta name="author" content="David Abrahams, Jeremy Siek, Thomas Witt" /> <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="organization" content="Boost Consulting, Indiana University Open Systems Lab, Zephyr Associates, Inc." />
@ -11,7 +11,6 @@
<link rel="stylesheet" href="default.css" type="text/css" /> <link rel="stylesheet" href="default.css" type="text/css" />
</head> </head>
<body> <body>
<div class="document" id="iterator-facade-and-adaptor">
<h1 class="title">Iterator Facade and Adaptor</h1> <h1 class="title">Iterator Facade and Adaptor</h1>
<table class="docinfo" frame="void" rules="none"> <table class="docinfo" frame="void" rules="none">
<col class="docinfo-name" /> <col class="docinfo-name" />
@ -32,6 +31,7 @@ committee's library working group.</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<div class="document" id="iterator-facade-and-adaptor">
<!-- Version 1.9 of this ReStructuredText document corresponds to <!-- Version 1.9 of this ReStructuredText document corresponds to
n1530_, the paper accepted by the LWG. --> n1530_, the paper accepted by the LWG. -->
<table class="field-list" frame="void" rules="none"> <table class="field-list" frame="void" rules="none">
@ -53,7 +53,7 @@ by adapting other iterators.</td>
</tbody> </tbody>
</table> </table>
<div class="contents topic" id="table-of-contents"> <div class="contents topic" id="table-of-contents">
<p class="topic-title"><a name="table-of-contents">Table of Contents</a></p> <p class="topic-title first"><a name="table-of-contents">Table of Contents</a></p>
<ul class="simple"> <ul class="simple">
<li><a class="reference" href="#motivation" id="id15" name="id15">Motivation</a></li> <li><a class="reference" href="#motivation" id="id15" name="id15">Motivation</a></li>
<li><a class="reference" href="#impact-on-the-standard" id="id16" name="id16">Impact on the Standard</a></li> <li><a class="reference" href="#impact-on-the-standard" id="id16" name="id16">Impact on the Standard</a></li>
@ -325,7 +325,7 @@ of the derived iterator type. These member functions are described
briefly below and in more detail in the iterator facade briefly below and in more detail in the iterator facade
requirements.</p> requirements.</p>
<blockquote> <blockquote>
<table border class="table"> <table border="1" class="table">
<colgroup> <colgroup>
<col width="44%" /> <col width="44%" />
<col width="56%" /> <col width="56%" />
@ -443,7 +443,6 @@ are described in terms of a set of requirements, which must be
satisfied by the <tt class="literal"><span class="pre">iterator_facade</span></tt> implementation.</p> satisfied by the <tt class="literal"><span class="pre">iterator_facade</span></tt> implementation.</p>
<table class="citation" frame="void" id="cop95" rules="none"> <table class="citation" frame="void" id="cop95" rules="none">
<colgroup><col class="label" /><col /></colgroup> <colgroup><col class="label" /><col /></colgroup>
<col />
<tbody valign="top"> <tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id4" name="cop95">[Cop95]</a></td><td>[Coplien, 1995] Coplien, J., Curiously Recurring Template <tr><td class="label"><a class="fn-backref" href="#id4" name="cop95">[Cop95]</a></td><td>[Coplien, 1995] Coplien, J., Curiously Recurring Template
Patterns, C++ Report, February 1995, pp. 24-27.</td></tr> Patterns, C++ Report, February 1995, pp. 24-27.</td></tr>
@ -776,8 +775,8 @@ object of a single pass iterator type interoperable with <tt class="literal"><sp
is a constant object of a random access traversal iterator type is a constant object of a random access traversal iterator type
interoperable with <tt class="literal"><span class="pre">X</span></tt>.</p> interoperable with <tt class="literal"><span class="pre">X</span></tt>.</p>
<a class="target" id="core-operations" name="core-operations"></a><div class="topic"> <a class="target" id="core-operations" name="core-operations"></a><div class="topic">
<p class="topic-title"><tt class="literal"><span class="pre">iterator_facade</span></tt> Core Operations</p> <p class="topic-title first"><tt class="literal"><span class="pre">iterator_facade</span></tt> Core Operations</p>
<table border class="table"> <table border="1" class="table">
<colgroup> <colgroup>
<col width="21%" /> <col width="21%" />
<col width="23%" /> <col width="23%" />
@ -1774,7 +1773,7 @@ type <tt class="literal"><span class="pre">iterator_traits&lt;Iterator&gt;::refe
traversal and iterator access concepts modeled by its <tt class="literal"><span class="pre">Iterator</span></tt> traversal and iterator access concepts modeled by its <tt class="literal"><span class="pre">Iterator</span></tt>
argument. In addition, it may model old iterator concepts argument. In addition, it may model old iterator concepts
specified in the following table:</p> specified in the following table:</p>
<table border class="table"> <table border="1" class="table">
<colgroup> <colgroup>
<col width="53%" /> <col width="53%" />
<col width="47%" /> <col width="47%" />
@ -1981,7 +1980,7 @@ concept that is modeled by the <tt class="literal"><span class="pre">Iterator</s
<p>If <tt class="literal"><span class="pre">transform_iterator</span></tt> is a model of Readable Lvalue Iterator then <p>If <tt class="literal"><span class="pre">transform_iterator</span></tt> is a model of Readable Lvalue Iterator then
it models the following original iterator concepts depending on what it models the following original iterator concepts depending on what
the <tt class="literal"><span class="pre">Iterator</span></tt> argument models.</p> the <tt class="literal"><span class="pre">Iterator</span></tt> argument models.</p>
<table border class="table"> <table border="1" class="table">
<colgroup> <colgroup>
<col width="47%" /> <col width="47%" />
<col width="53%" /> <col width="53%" />
@ -2038,17 +2037,20 @@ initialized to <tt class="literal"><span class="pre">f</span></tt> and <tt class
</tbody> </tbody>
</table> </table>
<pre class="literal-block"> <pre class="literal-block">
template&lt;class OtherIterator, class R2, class V2&gt; template&lt;class F2, class I2, class R2, class V2&gt;
transform_iterator( transform_iterator(
transform_iterator&lt;UnaryFunction, OtherIterator, R2, V2&gt; const&amp; t transform_iterator&lt;F2, I2, R2, V2&gt; const&amp; t
, typename enable_if_convertible&lt;OtherIterator, Iterator&gt;::type* = 0 // exposition , typename enable_if_convertible&lt;I2, Iterator&gt;::type* = 0 // exposition only
, typename enable_if_convertible&lt;F2, UnaryFunction&gt;::type* = 0 // exposition only
); );
</pre> </pre>
<table class="field-list" frame="void" rules="none"> <table class="field-list" frame="void" rules="none">
<col class="field-name" /> <col class="field-name" />
<col class="field-body" /> <col class="field-body" />
<tbody valign="top"> <tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">An instance of <tt class="literal"><span class="pre">transform_iterator</span></tt> that is a copy of <tt class="literal"><span class="pre">t</span></tt>.</td> <tr class="field"><th class="field-name">Returns:</th><td class="field-body">An instance of <tt class="literal"><span class="pre">transform_iterator</span></tt> with <tt class="literal"><span class="pre">m_f</span></tt>
initialized to <tt class="literal"><span class="pre">t.functor()</span></tt> and <tt class="literal"><span class="pre">m_iterator</span></tt> initialized to
<tt class="literal"><span class="pre">t.base()</span></tt>.</td>
</tr> </tr>
<tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="literal"><span class="pre">OtherIterator</span></tt> is implicitly convertible to <tt class="literal"><span class="pre">Iterator</span></tt>.</td> <tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="literal"><span class="pre">OtherIterator</span></tt> is implicitly convertible to <tt class="literal"><span class="pre">Iterator</span></tt>.</td>
</tr> </tr>
@ -2174,7 +2176,7 @@ the expression <tt class="literal"><span class="pre">p(x)</span></tt> must be va
<p>The concepts that <tt class="literal"><span class="pre">filter_iterator</span></tt> models are dependent on which <p>The concepts that <tt class="literal"><span class="pre">filter_iterator</span></tt> models are dependent on which
concepts the <tt class="literal"><span class="pre">Iterator</span></tt> argument models, as specified in the concepts the <tt class="literal"><span class="pre">Iterator</span></tt> argument models, as specified in the
following tables.</p> following tables.</p>
<table border class="table"> <table border="1" class="table">
<colgroup> <colgroup>
<col width="33%" /> <col width="33%" />
<col width="67%" /> <col width="67%" />
@ -2193,7 +2195,7 @@ following tables.</p>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<table border class="table"> <table border="1" class="table">
<colgroup> <colgroup>
<col width="41%" /> <col width="41%" />
<col width="59%" /> <col width="59%" />
@ -2215,7 +2217,7 @@ following tables.</p>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<table border class="table"> <table border="1" class="table">
<colgroup> <colgroup>
<col width="63%" /> <col width="63%" />
<col width="38%" /> <col width="38%" />

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -3,13 +3,13 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.3.1: http://docutils.sourceforge.net/" /> <meta name="generator" content="Docutils 0.3.4: http://docutils.sourceforge.net/" />
<title>The Boost.Iterator Library Boost</title> <title>The Boost.Iterator Library Boost</title>
<link rel="stylesheet" href="default.css" type="text/css" /> <link rel="stylesheet" href="default.css" type="text/css" />
</head> </head>
<body> <body>
<div class="document" id="the-boost-iterator-library-logo">
<h1 class="title">The Boost.Iterator Library <a class="reference" href="../../../index.htm"><img alt="Boost" src="../../../c++boost.gif" /></a></h1> <h1 class="title">The Boost.Iterator Library <a class="reference" href="../../../index.htm"><img alt="Boost" src="../../../c++boost.gif" /></a></h1>
<div class="document" id="the-boost-iterator-library-logo">
<hr /> <hr />
<table class="field-list" frame="void" rules="none"> <table class="field-list" frame="void" rules="none">
<col class="field-name" /> <col class="field-name" />
@ -51,7 +51,7 @@ older Boost Iterator Adaptor Library.</td>
</tbody> </tbody>
</table> </table>
<div class="contents topic" id="table-of-contents"> <div class="contents topic" id="table-of-contents">
<p class="topic-title"><a name="table-of-contents"><strong>Table of Contents</strong></a></p> <p class="topic-title first"><a name="table-of-contents"><strong>Table of Contents</strong></a></p>
<ul class="simple"> <ul class="simple">
<li><a class="reference" href="#new-style-iterators" id="id22" name="id22">New-Style Iterators</a></li> <li><a class="reference" href="#new-style-iterators" id="id22" name="id22">New-Style Iterators</a></li>
<li><a class="reference" href="#iterator-facade-and-adaptor" id="id23" name="id23">Iterator Facade and Adaptor</a></li> <li><a class="reference" href="#iterator-facade-and-adaptor" id="id23" name="id23">Iterator Facade and Adaptor</a></li>
@ -218,7 +218,6 @@ near-complete rewrite of the prototype, they came up with the
library you see today.</p> library you see today.</p>
<table class="citation" frame="void" id="cop95" rules="none"> <table class="citation" frame="void" id="cop95" rules="none">
<colgroup><col class="label" /><col /></colgroup> <colgroup><col class="label" /><col /></colgroup>
<col />
<tbody valign="top"> <tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id21" name="cop95">[Cop95]</a></td><td>[Coplien, 1995] Coplien, J., Curiously Recurring Template <tr><td class="label"><a class="fn-backref" href="#id21" name="cop95">[Cop95]</a></td><td>[Coplien, 1995] Coplien, J., Curiously Recurring Template
Patterns, C++ Report, February 1995, pp. 24-27.</td></tr> Patterns, C++ Report, February 1995, pp. 24-27.</td></tr>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -3,16 +3,15 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.3.1: http://docutils.sourceforge.net/" /> <meta name="generator" content="Docutils 0.3.4: http://docutils.sourceforge.net/" />
<title>New Iterator Concepts</title> <title>New Iterator Concepts</title>
<meta name="author" content="David Abrahams, Jeremy Siek, Thomas Witt" /> <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="organization" content="Boost Consulting, Indiana University Open Systems Lab, Zephyr Associates, Inc." />
<meta name="date" content="2004-04-06" /> <meta name="date" content="2004-07-14" />
<meta name="copyright" content="Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved" /> <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" /> <link rel="stylesheet" href="default.css" type="text/css" />
</head> </head>
<body> <body>
<div class="document" id="new-iterator-concepts">
<h1 class="title">New Iterator Concepts</h1> <h1 class="title">New Iterator Concepts</h1>
<table class="docinfo" frame="void" rules="none"> <table class="docinfo" frame="void" rules="none">
<col class="docinfo-name" /> <col class="docinfo-name" />
@ -26,7 +25,7 @@
<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 <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> Lab</a>, <a class="last reference" href="http://www.styleadvisor.com">Zephyr Associates, Inc.</a></td></tr>
<tr><th class="docinfo-name">Date:</th> <tr><th class="docinfo-name">Date:</th>
<td>2004-04-06</td></tr> <td>2004-07-14</td></tr>
<tr class="field"><th class="docinfo-name">Number:</th><td class="field-body">This is a revised version of <a class="reference" href="http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1550.html">n1550</a>=03-0133, which was <tr class="field"><th class="docinfo-name">Number:</th><td class="field-body">This is a revised version of <a class="reference" href="http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1550.html">n1550</a>=03-0133, which was
accepted for Technical Report 1 by the C++ standard accepted for Technical Report 1 by the C++ standard
committee's library working group. This proposal is a committee's library working group. This proposal is a
@ -37,6 +36,7 @@ revision of paper <a class="reference" href="http://anubis.dkuug.dk/jtc1/sc22/wg
2003. All rights reserved</td></tr> 2003. All rights reserved</td></tr>
</tbody> </tbody>
</table> </table>
<div class="document" id="new-iterator-concepts">
<!-- Version 1.25 of this ReStructuredText document is the same as <!-- Version 1.25 of this ReStructuredText document is the same as
n1550_, the paper accepted by the LWG. --> n1550_, the paper accepted by the LWG. -->
<table class="field-list" frame="void" rules="none"> <table class="field-list" frame="void" rules="none">
@ -52,7 +52,7 @@ of iterators that are used in practice.</td>
</tbody> </tbody>
</table> </table>
<div class="contents topic" id="table-of-contents"> <div class="contents topic" id="table-of-contents">
<p class="topic-title"><a name="table-of-contents">Table of Contents</a></p> <p class="topic-title first"><a name="table-of-contents">Table of Contents</a></p>
<ul class="simple"> <ul class="simple">
<li><a class="reference" href="#motivation" id="id1" name="id1">Motivation</a></li> <li><a class="reference" href="#motivation" id="id1" name="id1">Motivation</a></li>
<li><a class="reference" href="#impact-on-the-standard" id="id2" name="id2">Impact on the Standard</a><ul> <li><a class="reference" href="#impact-on-the-standard" id="id2" name="id2">Impact on the Standard</a><ul>
@ -107,7 +107,7 @@ geared towards iterator traversal (hence the category names), while
requirements that address value access sneak in at various places. The requirements that address value access sneak in at various places. The
following table gives a summary of the current value access following table gives a summary of the current value access
requirements in the iterator categories.</p> requirements in the iterator categories.</p>
<table border class="table"> <table border="1" class="table">
<colgroup> <colgroup>
<col width="31%" /> <col width="31%" />
<col width="69%" /> <col width="69%" />
@ -364,7 +364,7 @@ for value type <tt class="literal"><span class="pre">T</span></tt> if, in additi
Copy Constructible, the following expressions are valid and respect Copy Constructible, 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 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> type <tt class="literal"><span class="pre">T</span></tt>.</p>
<table border class="table"> <table border="1" class="table">
<colgroup> <colgroup>
<col width="28%" /> <col width="28%" />
<col width="20%" /> <col width="20%" />
@ -406,7 +406,7 @@ non-cv-qualified type</td>
if, in addition to <tt class="literal"><span class="pre">X</span></tt> being Copy Constructible, the following if, in addition to <tt class="literal"><span class="pre">X</span></tt> being Copy Constructible, the following
expressions are valid and respect the stated semantics. Writable expressions are valid and respect the stated semantics. Writable
Iterators have an associated <em>set of value types</em>.</p> Iterators have an associated <em>set of value types</em>.</p>
<table border class="table"> <table border="1" class="table">
<colgroup> <colgroup>
<col width="37%" /> <col width="37%" />
<col width="21%" /> <col width="21%" />
@ -435,7 +435,7 @@ value types of <tt class="literal"><span class="pre">X</span></tt></td>
<p>A class or built-in type <tt class="literal"><span class="pre">X</span></tt> models the <em>Swappable Iterator</em> concept <p>A class or built-in type <tt class="literal"><span class="pre">X</span></tt> models the <em>Swappable Iterator</em> concept
if, in addition to <tt class="literal"><span class="pre">X</span></tt> being Copy Constructible, the following if, in addition to <tt class="literal"><span class="pre">X</span></tt> being Copy Constructible, the following
expressions are valid and respect the stated semantics.</p> expressions are valid and respect the stated semantics.</p>
<table border class="table"> <table border="1" class="table">
<colgroup> <colgroup>
<col width="37%" /> <col width="37%" />
<col width="19%" /> <col width="19%" />
@ -457,17 +457,16 @@ exchanged</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<dl> <p>[<em>Note:</em> An iterator that is a model of the <a class="reference" href="#readable-iterator">Readable Iterator</a> and
<dt>[<em>Note:</em> An iterator that is a model of the <em>Readable</em> and <em>Writable Iterator</em> concepts</dt> <a class="reference" href="#writable-iterator">Writable Iterator</a> concepts is also a model of <em>Swappable
<dd>is also a model of <em>Swappable Iterator</em>. <em>--end note</em>]</dd> Iterator</em>. <em>--end note</em>]</p>
</dl>
</div> </div>
<div class="section" id="lvalue-iterators-lib-lvalue-iterators"> <div class="section" id="lvalue-iterators-lib-lvalue-iterators">
<h4><a class="toc-backref" href="#id14" name="lvalue-iterators-lib-lvalue-iterators">Lvalue Iterators [lib.lvalue.iterators]</a></h4> <h4><a class="toc-backref" href="#id14" 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 return <p>The <em>Lvalue Iterator</em> concept adds the requirement that the return
type of <tt class="literal"><span class="pre">operator*</span></tt> type be a reference to the value type of the type of <tt class="literal"><span class="pre">operator*</span></tt> type be a reference to the value type of the
iterator.</p> iterator.</p>
<table border class="table"> <table border="1" class="table">
<colgroup> <colgroup>
<col width="22%" /> <col width="22%" />
<col width="19%" /> <col width="19%" />
@ -487,14 +486,15 @@ iterator.</p>
<td><tt class="literal"><span class="pre">T</span></tt> is <em>cv</em> <td><tt class="literal"><span class="pre">T</span></tt> is <em>cv</em>
<tt class="literal"><span class="pre">iterator_traits&lt;X&gt;::value_type</span></tt> <tt class="literal"><span class="pre">iterator_traits&lt;X&gt;::value_type</span></tt>
where <em>cv</em> is an optional where <em>cv</em> is an optional
cv-qualification. cv-qualification. pre: <tt class="literal"><span class="pre">a</span></tt> is
pre: <tt class="literal"><span class="pre">a</span></tt> is dereferenceable.</td>
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>
</tbody> </tbody>
</table> </table>
<p>If <tt class="literal"><span class="pre">X</span></tt> is a <a class="reference" href="#writable-iterator">Writable Iterator</a> then <tt class="literal"><span class="pre">a</span> <span class="pre">==</span> <span class="pre">b</span></tt> if and only if
<tt class="literal"><span class="pre">*a</span></tt> is the same object as <tt class="literal"><span class="pre">*b</span></tt>. If <tt class="literal"><span class="pre">X</span></tt> is a <a class="reference" href="#readable-iterator">Readable
Iterator</a> then <tt class="literal"><span class="pre">a</span> <span class="pre">==</span> <span class="pre">b</span></tt> implies <tt class="literal"><span class="pre">*a</span></tt> is the same object as
<tt class="literal"><span class="pre">*b</span></tt>.</p>
</div> </div>
</div> </div>
<div class="section" id="iterator-traversal-concepts-lib-iterator-traversal"> <div class="section" id="iterator-traversal-concepts-lib-iterator-traversal">
@ -509,18 +509,18 @@ type <tt class="literal"><span class="pre">X</span></tt>, <tt class="literal"><s
concept if, in addition to <tt class="literal"><span class="pre">X</span></tt> being Assignable and Copy concept if, in addition to <tt class="literal"><span class="pre">X</span></tt> being Assignable and Copy
Constructible, the following expressions are valid and respect the Constructible, the following expressions are valid and respect the
stated semantics.</p> stated semantics.</p>
<table border class="table"> <table border="1" class="table">
<colgroup> <colgroup>
<col width="39%" /> <col width="39%" />
<col width="37%" /> <col width="38%" />
<col width="24%" /> <col width="23%" />
</colgroup> </colgroup>
<thead valign="bottom"> <thead valign="bottom">
<tr><th colspan="3">Incrementable Iterator Requirements (in addition to Assignable, Copy Constructible)</th> <tr><th colspan="3">Incrementable Iterator Requirements (in addition to Assignable, Copy Constructible)</th>
</tr> </tr>
<tr><th>Expression</th> <tr><th>Expression</th>
<th>Return Type</th> <th>Return Type</th>
<th>Assertion/Semantics</th> <th>Assertion</th>
</tr> </tr>
</thead> </thead>
<tbody valign="top"> <tbody valign="top">
@ -529,15 +529,12 @@ stated semantics.</p>
<td><tt class="literal"><span class="pre">&amp;r</span> <span class="pre">==</span> <span class="pre">&amp;++r</span></tt></td> <td><tt class="literal"><span class="pre">&amp;r</span> <span class="pre">==</span> <span class="pre">&amp;++r</span></tt></td>
</tr> </tr>
<tr><td><tt class="literal"><span class="pre">r++</span></tt></td> <tr><td><tt class="literal"><span class="pre">r++</span></tt></td>
<td><tt class="literal"><span class="pre">X</span></tt></td> <td>&nbsp;</td>
<td><pre class="first last literal-block"> <td>&nbsp;</td>
{ </tr>
X tmp = r; <tr><td><tt class="literal"><span class="pre">*r++</span></tt></td>
++r; <td>&nbsp;</td>
return tmp; <td>&nbsp;</td>
}
</pre>
</td>
</tr> </tr>
<tr><td><tt class="literal"><span class="pre">iterator_traversal&lt;X&gt;::type</span></tt></td> <tr><td><tt class="literal"><span class="pre">iterator_traversal&lt;X&gt;::type</span></tt></td>
<td>Convertible to <td>Convertible to
@ -546,6 +543,11 @@ stated semantics.</p>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<p>If <tt class="literal"><span class="pre">X</span></tt> is a <a class="reference" href="#writable-iterator">Writable Iterator</a> then <tt class="literal"><span class="pre">X</span> <span class="pre">a(r++);</span></tt> is equivalent
to <tt class="literal"><span class="pre">X</span> <span class="pre">a(r);</span> <span class="pre">++r;</span></tt> and <tt class="literal"><span class="pre">*r++</span> <span class="pre">=</span> <span class="pre">o</span></tt> is equivalent
to <tt class="literal"><span class="pre">*r</span> <span class="pre">=</span> <span class="pre">o;</span> <span class="pre">++r</span></tt>.
If <tt class="literal"><span class="pre">X</span></tt> is a <a class="reference" href="#readable-iterator">Readable Iterator</a> then <tt class="literal"><span class="pre">T</span> <span class="pre">z(*r++);</span></tt> is equivalent
to <tt class="literal"><span class="pre">T</span> <span class="pre">z(*r);</span> <span class="pre">++r;</span></tt>.</p>
<!-- TR1: incrementable_iterator_tag changed to <!-- TR1: incrementable_iterator_tag changed to
incrementable_traversal_tag for consistency. --> incrementable_traversal_tag for consistency. -->
</div> </div>
@ -554,25 +556,29 @@ incrementable_traversal_tag for consistency. -->
<p>A class or built-in type <tt class="literal"><span class="pre">X</span></tt> models the <em>Single Pass Iterator</em> <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 concept if the following expressions are valid and respect the stated
semantics.</p> semantics.</p>
<table border class="table"> <table border="1" class="table">
<colgroup> <colgroup>
<col width="36%" /> <col width="32%" />
<col width="33%" /> <col width="29%" />
<col width="31%" /> <col width="13%" />
<col width="27%" />
</colgroup> </colgroup>
<thead valign="bottom"> <thead valign="bottom">
<tr><th colspan="3">Single Pass Iterator Requirements (in addition to Incrementable Iterator and Equality <tr><th colspan="4">Single Pass Iterator Requirements (in addition to Incrementable Iterator and Equality
Comparable)</th> Comparable)</th>
</tr> </tr>
<tr><th>Expression</th> <tr><th>Expression</th>
<th>Return Type</th> <th>Return Type</th>
<th>Assertion/Semantics / <th>Operational
Semantics</th>
<th>Assertion/
Pre-/Post-condition</th> Pre-/Post-condition</th>
</tr> </tr>
</thead> </thead>
<tbody valign="top"> <tbody valign="top">
<tr><td><tt class="literal"><span class="pre">++r</span></tt></td> <tr><td><tt class="literal"><span class="pre">++r</span></tt></td>
<td><tt class="literal"><span class="pre">X&amp;</span></tt></td> <td><tt class="literal"><span class="pre">X&amp;</span></tt></td>
<td>&nbsp;</td>
<td>pre: <tt class="literal"><span class="pre">r</span></tt> is <td>pre: <tt class="literal"><span class="pre">r</span></tt> is
dereferenceable; post: dereferenceable; post:
<tt class="literal"><span class="pre">r</span></tt> is dereferenceable or <tt class="literal"><span class="pre">r</span></tt> is dereferenceable or
@ -580,17 +586,20 @@ dereferenceable; post:
</tr> </tr>
<tr><td><tt class="literal"><span class="pre">a</span> <span class="pre">==</span> <span class="pre">b</span></tt></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>convertible to <tt class="literal"><span class="pre">bool</span></tt></td>
<td>&nbsp;</td>
<td><tt class="literal"><span class="pre">==</span></tt> is an equivalence <td><tt class="literal"><span class="pre">==</span></tt> is an equivalence
relation over its domain</td> relation over its domain</td>
</tr> </tr>
<tr><td><tt class="literal"><span class="pre">a</span> <span class="pre">!=</span> <span class="pre">b</span></tt></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>convertible to <tt class="literal"><span class="pre">bool</span></tt></td>
<td><tt class="literal"><span class="pre">!(a</span> <span class="pre">==</span> <span class="pre">b)</span></tt></td> <td><tt class="literal"><span class="pre">!(a</span> <span class="pre">==</span> <span class="pre">b)</span></tt></td>
<td>&nbsp;</td>
</tr> </tr>
<tr><td><tt class="literal"><span class="pre">iterator_traversal&lt;X&gt;::type</span></tt></td> <tr><td><tt class="literal"><span class="pre">iterator_traversal&lt;X&gt;::type</span></tt></td>
<td>Convertible to <td>Convertible to
<tt class="literal"><span class="pre">single_pass_traversal_tag</span></tt></td> <tt class="literal"><span class="pre">single_pass_traversal_tag</span></tt></td>
<td>&nbsp;</td> <td>&nbsp;</td>
<td>&nbsp;</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -603,7 +612,7 @@ single_pass_traversal_tag for consistency -->
concept if, in addition to <tt class="literal"><span class="pre">X</span></tt> meeting the requirements of Default concept if, in addition to <tt class="literal"><span class="pre">X</span></tt> meeting the requirements of Default
Constructible and Single Pass Iterator, the following expressions are Constructible and Single Pass Iterator, the following expressions are
valid and respect the stated semantics.</p> valid and respect the stated semantics.</p>
<table border class="table"> <table border="1" class="table">
<colgroup> <colgroup>
<col width="38%" /> <col width="38%" />
<col width="34%" /> <col width="34%" />
@ -650,34 +659,39 @@ forward_traversal_tag for consistency -->
Iterator</em> concept if, in addition to <tt class="literal"><span class="pre">X</span></tt> meeting the requirements of Iterator</em> concept if, in addition to <tt class="literal"><span class="pre">X</span></tt> meeting the requirements of
Forward Traversal Iterator, the following expressions are valid and Forward Traversal Iterator, the following expressions are valid and
respect the stated semantics.</p> respect the stated semantics.</p>
<table border class="table"> <table border="1" class="table">
<colgroup> <colgroup>
<col width="38%" /> <col width="33%" />
<col width="37%" /> <col width="32%" />
<col width="25%" /> <col width="14%" />
<col width="21%" />
</colgroup> </colgroup>
<thead valign="bottom"> <thead valign="bottom">
<tr><th colspan="3">Bidirectional Traversal Iterator Requirements (in addition to Forward Traversal <tr><th colspan="4">Bidirectional Traversal Iterator Requirements (in addition to Forward Traversal
Iterator)</th> Iterator)</th>
</tr> </tr>
<tr><th>Expression</th> <tr><th>Expression</th>
<th>Return Type</th> <th>Return Type</th>
<th>Assertion/Semantics / <th>Operational
Semantics</th>
<th>Assertion/
Pre-/Post-condition</th> Pre-/Post-condition</th>
</tr> </tr>
</thead> </thead>
<tbody valign="top"> <tbody valign="top">
<tr><td><tt class="literal"><span class="pre">--r</span></tt></td> <tr><td><tt class="literal"><span class="pre">--r</span></tt></td>
<td><tt class="literal"><span class="pre">X&amp;</span></tt></td> <td><tt class="literal"><span class="pre">X&amp;</span></tt></td>
<td>pre: there exists <td>&nbsp;</td>
<td><p class="first">pre: there exists
<tt class="literal"><span class="pre">s</span></tt> such that <tt class="literal"><span class="pre">r</span> <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: <span class="pre">==</span> <span class="pre">++s</span></tt>. post:
<tt class="literal"><span class="pre">s</span></tt> is <tt class="literal"><span class="pre">s</span></tt> is
dereferenceable. dereferenceable.</p>
<tt class="literal"><span class="pre">--(++r)</span> <span class="pre">==</span> <span class="pre">r</span></tt>. <p class="last"><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> <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> 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">&amp;r</span> <span class="pre">==</span> <span class="pre">&amp;--r</span></tt>.</td> <span class="pre">s</span></tt>. <tt class="literal"><span class="pre">&amp;r</span> <span class="pre">==</span> <span class="pre">&amp;--r</span></tt>.</p>
</td>
</tr> </tr>
<tr><td><tt class="literal"><span class="pre">r--</span></tt></td> <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&amp;</span></tt></td> <td>convertible to <tt class="literal"><span class="pre">const</span> <span class="pre">X&amp;</span></tt></td>
@ -689,11 +703,13 @@ implies <tt class="literal"><span class="pre">r</span> <span class="pre">==</spa
} }
</pre> </pre>
</td> </td>
<td>&nbsp;</td>
</tr> </tr>
<tr><td><tt class="literal"><span class="pre">iterator_traversal&lt;X&gt;::type</span></tt></td> <tr><td><tt class="literal"><span class="pre">iterator_traversal&lt;X&gt;::type</span></tt></td>
<td>Convertible to <td>Convertible to
<tt class="literal"><span class="pre">bidirectional_traversal_tag</span></tt></td> <tt class="literal"><span class="pre">bidirectional_traversal_tag</span></tt></td>
<td>&nbsp;</td> <td>&nbsp;</td>
<td>&nbsp;</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -707,7 +723,7 @@ 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 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&lt;X&gt;::difference_type</span></tt> and <tt class="literal"><span class="pre">n</span></tt> represents a <tt class="literal"><span class="pre">iterator_traits&lt;X&gt;::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> constant object of type <tt class="literal"><span class="pre">Distance</span></tt>.</p>
<table border class="table"> <table border="1" class="table">
<colgroup> <colgroup>
<col width="28%" /> <col width="28%" />
<col width="30%" /> <col width="30%" />
@ -772,14 +788,14 @@ value <tt class="literal"><span class="pre">n</span></tt> of
<tr><td><tt class="literal"><span class="pre">a[n]</span></tt></td> <tr><td><tt class="literal"><span class="pre">a[n]</span></tt></td>
<td>convertible to T</td> <td>convertible to T</td>
<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">*(a</span> <span class="pre">+</span> <span class="pre">n)</span></tt></td>
<td>pre: a is a <a class="reference" href="#readable-iterator">readable <td>pre: a is a <a class="reference" href="#readable-iterator">Readable
iterator</a></td> Iterator</a></td>
</tr> </tr>
<tr><td><tt class="literal"><span class="pre">a[n]</span> <span class="pre">=</span> <span class="pre">v</span></tt></td> <tr><td><tt class="literal"><span class="pre">a[n]</span> <span class="pre">=</span> <span class="pre">v</span></tt></td>
<td>convertible to T</td> <td>convertible to T</td>
<td><tt class="literal"><span class="pre">*(a</span> <span class="pre">+</span> <span class="pre">n)</span> <span class="pre">=</span> <span class="pre">v</span></tt></td> <td><tt class="literal"><span class="pre">*(a</span> <span class="pre">+</span> <span class="pre">n)</span> <span class="pre">=</span> <span class="pre">v</span></tt></td>
<td>pre: a is a <a class="reference" href="#writable-iterator">writable <td>pre: a is a <a class="reference" href="#writable-iterator">Writable
iterator</a></td> Iterator</a></td>
</tr> </tr>
<tr><td><tt class="literal"><span class="pre">a</span> <span class="pre">&lt;</span> <span class="pre">b</span></tt></td> <tr><td><tt class="literal"><span class="pre">a</span> <span class="pre">&lt;</span> <span class="pre">b</span></tt></td>
<td>convertible to <tt class="literal"><span class="pre">bool</span></tt></td> <td>convertible to <tt class="literal"><span class="pre">bool</span></tt></td>
@ -823,7 +839,7 @@ respect the stated semantics. In the tables below, <tt class="literal"><span cla
of type <tt class="literal"><span class="pre">X</span></tt>, <tt class="literal"><span class="pre">y</span></tt> is an object of type <tt class="literal"><span class="pre">Y</span></tt>, <tt class="literal"><span class="pre">Distance</span></tt> is of type <tt class="literal"><span class="pre">X</span></tt>, <tt class="literal"><span class="pre">y</span></tt> is an object of type <tt class="literal"><span class="pre">Y</span></tt>, <tt class="literal"><span class="pre">Distance</span></tt> is
<tt class="literal"><span class="pre">iterator_traits&lt;Y&gt;::difference_type</span></tt>, and <tt class="literal"><span class="pre">n</span></tt> represents a <tt class="literal"><span class="pre">iterator_traits&lt;Y&gt;::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> constant object of type <tt class="literal"><span class="pre">Distance</span></tt>.</p>
<table border class="table"> <table border="1" class="table">
<colgroup> <colgroup>
<col width="13%" /> <col width="13%" />
<col width="27%" /> <col width="27%" />
@ -864,7 +880,7 @@ constant object of type <tt class="literal"><span class="pre">Distance</span></t
</table> </table>
<p>If <tt class="literal"><span class="pre">X</span></tt> and <tt class="literal"><span class="pre">Y</span></tt> both model Random Access Traversal Iterator then <p>If <tt class="literal"><span class="pre">X</span></tt> and <tt class="literal"><span class="pre">Y</span></tt> both model Random Access Traversal Iterator then
the following additional requirements must be met.</p> the following additional requirements must be met.</p>
<table border class="table"> <table border="1" class="table">
<colgroup> <colgroup>
<col width="12%" /> <col width="12%" />
<col width="25%" /> <col width="25%" />
@ -998,5 +1014,10 @@ LocalWords: incrementable xxx min prev inplace png oldeqnew AccessTag struct
LocalWords: TraversalTag typename lvalues DWA Hmm JGS mis enum --> LocalWords: TraversalTag typename lvalues DWA Hmm JGS mis enum -->
</div> </div>
</div> </div>
<hr class="footer" />
<div class="footer">
<a class="reference" href="new-iter-concepts.rst">View document source</a>.
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> </body>
</html> </html>

Binary file not shown.

View File

@ -412,8 +412,9 @@ expressions are valid and respect the stated semantics.
| | |exchanged | | | |exchanged |
+-------------------------+-------------+-----------------------------+ +-------------------------+-------------+-----------------------------+
[*Note:* An iterator that is a model of the *Readable* and *Writable Iterator* concepts [*Note:* An iterator that is a model of the `Readable Iterator`_ and
is also a model of *Swappable Iterator*. *--end note*] `Writable Iterator`_ concepts is also a model of *Swappable
Iterator*. *--end note*]
Lvalue Iterators [lib.lvalue.iterators] Lvalue Iterators [lib.lvalue.iterators]
@ -432,15 +433,13 @@ iterator.
| | |``iterator_traits<X>::value_type`` | | | |``iterator_traits<X>::value_type`` |
| | |where *cv* is an optional | | | |where *cv* is an optional |
| | |cv-qualification. pre: ``a`` is | | | |cv-qualification. pre: ``a`` is |
| | |dereferenceable. If ``X`` is a | | | |dereferenceable. |
| | |*Writable Iterator* then ``a == b``|
| | |if and only if ``*a`` is the same |
| | |object as ``*b``. If ``X`` is a |
| | |*Readable Iterator* then ``a == b``|
| | |implies ``*a`` is the same object |
| | |as ``*b``. |
+-------------+-----------+-----------------------------------+ +-------------+-----------+-----------------------------------+
If ``X`` is a `Writable Iterator`_ then ``a == b`` if and only if
``*a`` is the same object as ``*b``. If ``X`` is a `Readable
Iterator`_ then ``a == b`` implies ``*a`` is the same object as
``*b``.
Iterator Traversal Concepts [lib.iterator.traversal] Iterator Traversal Concepts [lib.iterator.traversal]
@ -451,7 +450,6 @@ constant objects of type ``X``, ``r`` and ``s`` are mutable objects of
type ``X``, ``T`` is ``std::iterator_traits<X>::value_type``, and type ``X``, ``T`` is ``std::iterator_traits<X>::value_type``, and
``v`` is a constant object of type ``T``. ``v`` is a constant object of type ``T``.
Incrementable Iterators [lib.incrementable.iterators] Incrementable Iterators [lib.incrementable.iterators]
----------------------------------------------------- -----------------------------------------------------
@ -460,32 +458,28 @@ concept if, in addition to ``X`` being Assignable and Copy
Constructible, the following expressions are valid and respect the Constructible, the following expressions are valid and respect the
stated semantics. stated semantics.
+------------------------------------------------------------------------------------+
+----------------------------------------------------------------------------------------+
|Incrementable Iterator Requirements (in addition to Assignable, Copy Constructible) | |Incrementable Iterator Requirements (in addition to Assignable, Copy Constructible) |
| | | |
+--------------------------------+-------------------------------+-----------------------+ +--------------------------------+-------------------------------+-------------------+
|Expression |Return Type |Assertion/Semantics | |Expression |Return Type |Assertion |
+================================+===============================+=======================+ +================================+===============================+===================+
|``++r`` |``X&`` |``&r == &++r`` | |``++r`` |``X&`` |``&r == &++r`` |
+--------------------------------+-------------------------------+-----------------------+ +--------------------------------+-------------------------------+-------------------+
|``r++`` |convertible to ``const X&`` |``X a(r++);`` is | |``r++`` | | |
| | |equivalent to ``X a(r);| +--------------------------------+-------------------------------+-------------------+
| | |++r;`` | |``*r++`` | | |
+--------------------------------+-------------------------------+-----------------------+ +--------------------------------+-------------------------------+-------------------+
|``*r++`` |if ``X`` is a *Readable |If ``X`` is a *Readable|
| |Iterator* then ``T`` |Iterator* then ``T |
| | |z(*r++);`` is |
| | |equivalent to ``T |
| | |z(*r); ++r;``. If ``X``|
| | |is a *Writable |
| | |Iterator* then ``*r++ =|
| | |o`` is equivalent to |
| | |``*r = o; ++r``. |
+--------------------------------+-------------------------------+-----------------------+
|``iterator_traversal<X>::type`` |Convertible to | | |``iterator_traversal<X>::type`` |Convertible to | |
| |``incrementable_traversal_tag``| | | |``incrementable_traversal_tag``| |
+--------------------------------+-------------------------------+-----------------------+ +--------------------------------+-------------------------------+-------------------+
If ``X`` is a `Writable Iterator`_ then ``X a(r++);`` is equivalent
to ``X a(r); ++r;`` and ``*r++ = o`` is equivalent
to ``*r = o; ++r``.
If ``X`` is a `Readable Iterator`_ then ``T z(*r++);`` is equivalent
to ``T z(*r); ++r;``.
.. TR1: incrementable_iterator_tag changed to .. TR1: incrementable_iterator_tag changed to
incrementable_traversal_tag for consistency. incrementable_traversal_tag for consistency.
@ -498,26 +492,26 @@ concept if the following expressions are valid and respect the stated
semantics. semantics.
+------------------------------------------------------------------------------------------+ +--------------------------------------------------------------------------------------------------------+
|Single Pass Iterator Requirements (in addition to Incrementable Iterator and Equality | |Single Pass Iterator Requirements (in addition to Incrementable Iterator and Equality |
|Comparable) | |Comparable) |
+--------------------------------+-----------------------------+---------------------------+ +--------------------------------+-----------------------------+-------------+---------------------------+
|Expression |Return Type |Assertion/Semantics / | |Expression |Return Type | Operational |Assertion/ |
| | |Pre-/Post-condition | | | | Semantics |Pre-/Post-condition |
+================================+=============================+===========================+ +================================+=============================+=============+===========================+
|``++r`` |``X&`` |pre: ``r`` is | |``++r`` |``X&`` | |pre: ``r`` is |
| | |dereferenceable; post: | | | | |dereferenceable; post: |
| | |``r`` is dereferenceable or| | | | |``r`` is dereferenceable or|
| | |``r`` is past-the-end | | | | |``r`` is past-the-end |
+--------------------------------+-----------------------------+---------------------------+ +--------------------------------+-----------------------------+-------------+---------------------------+
|``a == b`` |convertible to ``bool`` |``==`` is an equivalence | |``a == b`` |convertible to ``bool`` | |``==`` is an equivalence |
| | |relation over its domain | | | | |relation over its domain |
+--------------------------------+-----------------------------+---------------------------+ +--------------------------------+-----------------------------+-------------+---------------------------+
|``a != b`` |convertible to ``bool`` |``!(a == b)`` | |``a != b`` |convertible to ``bool`` |``!(a == b)``| |
+--------------------------------+-----------------------------+---------------------------+ +--------------------------------+-----------------------------+-------------+---------------------------+
|``iterator_traversal<X>::type`` |Convertible to | | |``iterator_traversal<X>::type`` |Convertible to | | |
| |``single_pass_traversal_tag``| | | |``single_pass_traversal_tag``| | |
+--------------------------------+-----------------------------+---------------------------+ +--------------------------------+-----------------------------+-------------+---------------------------+
.. TR1: single_pass_iterator_tag changed to .. TR1: single_pass_iterator_tag changed to
single_pass_traversal_tag for consistency single_pass_traversal_tag for consistency
@ -565,35 +559,36 @@ Iterator* concept if, in addition to ``X`` meeting the requirements of
Forward Traversal Iterator, the following expressions are valid and Forward Traversal Iterator, the following expressions are valid and
respect the stated semantics. respect the stated semantics.
+--------------------------------------------------------------------------------------+ +-----------------------------------------------------------------------------------------------------+
|Bidirectional Traversal Iterator Requirements (in addition to Forward Traversal | |Bidirectional Traversal Iterator Requirements (in addition to Forward Traversal |
|Iterator) | |Iterator) |
+--------------------------------+-------------------------------+---------------------+ +--------------------------------+-------------------------------+--------------+---------------------+
|Expression |Return Type |Assertion/Semantics /| |Expression |Return Type | Operational |Assertion/ |
| | |Pre-/Post-condition | | | | Semantics |Pre-/Post-condition |
+================================+===============================+=====================+ +================================+===============================+==============+=====================+
|``--r`` |``X&`` |pre: there exists | |``--r`` |``X&`` | |pre: there exists |
| | |``s`` such that ``r | | | | |``s`` such that ``r |
| | |== ++s``. post: | | | | |== ++s``. post: |
| | |``s`` is | | | | |``s`` is |
| | |dereferenceable. | | | | |dereferenceable. |
| | |``--(++r) == r``. | | | | | |
| | |``--r == --s`` | | | | |``++(--r) == r``. |
| | |implies ``r == | | | | |``--r == --s`` |
| | |s``. ``&r == &--r``. | | | | |implies ``r == |
+--------------------------------+-------------------------------+---------------------+ | | | |s``. ``&r == &--r``. |
|``r--`` |convertible to ``const X&`` |:: | +--------------------------------+-------------------------------+--------------+---------------------+
| | | | |``r--`` |convertible to ``const X&`` |:: | |
| | | { | | | | | |
| | | X tmp = r; | | | | { | |
| | | --r; | | | | X tmp = r; | |
| | | return tmp; | | | | --r; | |
| | | } | | | | return tmp;| |
+--------------------------------+-------------------------------+---------------------+ | | | } | |
|``iterator_traversal<X>::type`` |Convertible to | | +--------------------------------+-------------------------------+--------------+---------------------+
| |``bidirectional_traversal_tag``| | |``iterator_traversal<X>::type`` |Convertible to | | |
| | | | | |``bidirectional_traversal_tag``| | |
+--------------------------------+-------------------------------+---------------------+ | | | | |
+--------------------------------+-------------------------------+--------------+---------------------+
.. TR1: bidirectional_traversal_iterator_tag changed to .. TR1: bidirectional_traversal_iterator_tag changed to
bidirectional_traversal_tag for consistency bidirectional_traversal_tag for consistency
@ -642,11 +637,11 @@ constant object of type ``Distance``.
| | | |``a + n == b``. ``b | | | | |``a + n == b``. ``b |
| | | |== a + (b - a)``. | | | | |== a + (b - a)``. |
+-------------------------------+---------------------------------+-------------------------+----------------------+ +-------------------------------+---------------------------------+-------------------------+----------------------+
|``a[n]`` |convertible to T |``*(a + n)`` |pre: a is a `readable | |``a[n]`` |convertible to T |``*(a + n)`` |pre: a is a `Readable |
| | | |iterator`_ | | | | |Iterator`_ |
+-------------------------------+---------------------------------+-------------------------+----------------------+ +-------------------------------+---------------------------------+-------------------------+----------------------+
|``a[n] = v`` |convertible to T |``*(a + n) = v`` |pre: a is a `writable | |``a[n] = v`` |convertible to T |``*(a + n) = v`` |pre: a is a `Writable |
| | | |iterator`_ | | | | |Iterator`_ |
+-------------------------------+---------------------------------+-------------------------+----------------------+ +-------------------------------+---------------------------------+-------------------------+----------------------+
|``a < b`` |convertible to ``bool`` |``b - a > 0`` |``<`` is a total | |``a < b`` |convertible to ``bool`` |``b - a > 0`` |``<`` is a total |
| | | |ordering relation | | | | |ordering relation |

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.3.1: http://docutils.sourceforge.net/" /> <meta name="generator" content="Docutils 0.3.4: http://docutils.sourceforge.net/" />
<title>Transform Iterator</title> <title>Transform Iterator</title>
<meta name="author" content="David Abrahams, Jeremy Siek, Thomas Witt" /> <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="organization" content="Boost Consulting, Indiana University Open Systems Lab, University of Hanover Institute for Transport Railway Operation and Construction" />
@ -12,7 +12,6 @@
<link rel="stylesheet" href="default.css" type="text/css" /> <link rel="stylesheet" href="default.css" type="text/css" />
</head> </head>
<body> <body>
<div class="document" id="transform-iterator">
<h1 class="title">Transform Iterator</h1> <h1 class="title">Transform Iterator</h1>
<table class="docinfo" frame="void" rules="none"> <table class="docinfo" frame="void" rules="none">
<col class="docinfo-name" /> <col class="docinfo-name" />
@ -32,6 +31,7 @@ Railway Operation and Construction</a></td></tr>
<td>Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved</td></tr> <td>Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. All rights reserved</td></tr>
</tbody> </tbody>
</table> </table>
<div class="document" id="transform-iterator">
<table class="field-list" frame="void" rules="none"> <table class="field-list" frame="void" rules="none">
<col class="field-name" /> <col class="field-name" />
<col class="field-body" /> <col class="field-body" />
@ -43,7 +43,7 @@ dereferencing the iterator and returning the result.</td>
</tbody> </tbody>
</table> </table>
<div class="contents topic" id="table-of-contents"> <div class="contents topic" id="table-of-contents">
<p class="topic-title"><a name="table-of-contents">Table of Contents</a></p> <p class="topic-title first"><a name="table-of-contents">Table of Contents</a></p>
<ul class="simple"> <ul class="simple">
<li><a class="reference" href="#transform-iterator-synopsis" id="id2" name="id2"><tt class="literal"><span class="pre">transform_iterator</span></tt> synopsis</a></li> <li><a class="reference" href="#transform-iterator-synopsis" id="id2" name="id2"><tt class="literal"><span class="pre">transform_iterator</span></tt> synopsis</a></li>
<li><a class="reference" href="#transform-iterator-requirements" id="id3" name="id3"><tt class="literal"><span class="pre">transform_iterator</span></tt> requirements</a></li> <li><a class="reference" href="#transform-iterator-requirements" id="id3" name="id3"><tt class="literal"><span class="pre">transform_iterator</span></tt> requirements</a></li>
@ -130,7 +130,7 @@ concept that is modeled by the <tt class="literal"><span class="pre">Iterator</s
<p>If <tt class="literal"><span class="pre">transform_iterator</span></tt> is a model of Readable Lvalue Iterator then <p>If <tt class="literal"><span class="pre">transform_iterator</span></tt> is a model of Readable Lvalue Iterator then
it models the following original iterator concepts depending on what it models the following original iterator concepts depending on what
the <tt class="literal"><span class="pre">Iterator</span></tt> argument models.</p> the <tt class="literal"><span class="pre">Iterator</span></tt> argument models.</p>
<table border class="table"> <table border="1" class="table">
<colgroup> <colgroup>
<col width="47%" /> <col width="47%" />
<col width="53%" /> <col width="53%" />
@ -187,17 +187,20 @@ initialized to <tt class="literal"><span class="pre">f</span></tt> and <tt class
</tbody> </tbody>
</table> </table>
<pre class="literal-block"> <pre class="literal-block">
template&lt;class OtherIterator, class R2, class V2&gt; template&lt;class F2, class I2, class R2, class V2&gt;
transform_iterator( transform_iterator(
transform_iterator&lt;UnaryFunction, OtherIterator, R2, V2&gt; const&amp; t transform_iterator&lt;F2, I2, R2, V2&gt; const&amp; t
, typename enable_if_convertible&lt;OtherIterator, Iterator&gt;::type* = 0 // exposition , typename enable_if_convertible&lt;I2, Iterator&gt;::type* = 0 // exposition only
, typename enable_if_convertible&lt;F2, UnaryFunction&gt;::type* = 0 // exposition only
); );
</pre> </pre>
<table class="field-list" frame="void" rules="none"> <table class="field-list" frame="void" rules="none">
<col class="field-name" /> <col class="field-name" />
<col class="field-body" /> <col class="field-body" />
<tbody valign="top"> <tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">An instance of <tt class="literal"><span class="pre">transform_iterator</span></tt> that is a copy of <tt class="literal"><span class="pre">t</span></tt>.</td> <tr class="field"><th class="field-name">Returns:</th><td class="field-body">An instance of <tt class="literal"><span class="pre">transform_iterator</span></tt> with <tt class="literal"><span class="pre">m_f</span></tt>
initialized to <tt class="literal"><span class="pre">t.functor()</span></tt> and <tt class="literal"><span class="pre">m_iterator</span></tt> initialized to
<tt class="literal"><span class="pre">t.base()</span></tt>.</td>
</tr> </tr>
<tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="literal"><span class="pre">OtherIterator</span></tt> is implicitly convertible to <tt class="literal"><span class="pre">Iterator</span></tt>.</td> <tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="literal"><span class="pre">OtherIterator</span></tt> is implicitly convertible to <tt class="literal"><span class="pre">Iterator</span></tt>.</td>
</tr> </tr>

Binary file not shown.

View File

@ -138,8 +138,8 @@ operations.
); );
:Returns: An instance of ``transform_iterator`` with ``m_f`` :Returns: An instance of ``transform_iterator`` with ``m_f``
initialized to ``t.functor()`` and ``m_iterator`` initialized to initialized to ``t.functor()`` and ``m_iterator`` initialized to
``t.base()``. ``t.base()``.
:Requires: ``OtherIterator`` is implicitly convertible to ``Iterator``. :Requires: ``OtherIterator`` is implicitly convertible to ``Iterator``.

Binary file not shown.