2004-01-27 17:03:46 +00:00
<?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" />
2006-09-11 22:08:18 +00:00
< meta name = "generator" content = "Docutils 0.4: http://docutils.sourceforge.net/" />
2004-11-02 14:31:27 +00:00
< title ></ title >
2006-09-11 22:08:18 +00:00
< style type = "text/css" >
/*
:Author: David Goodger
:Contact: goodger@users.sourceforge.net
:Date: $Date$
:Revision: $Revision$
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
. borderless , table . borderless td , table . borderless th {
border : 0 }
table . borderless td , table . borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding : 0 0.5 em 0 0 ! important }
. first {
/* Override more specific margin styles with "! important". */
margin-top : 0 ! important }
. last , . with-subtitle {
margin-bottom : 0 ! important }
. hidden {
display : none }
a . toc-backref {
text-decoration : none ;
color : black }
blockquote . epigraph {
margin : 2 em 5 em ; }
dl . docutils dd {
margin-bottom : 0.5 em }
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div . abstract {
margin : 2 em 5 em }
div . abstract p . topic-title {
font-weight : bold ;
text-align : center }
div . admonition , div . attention , div . caution , div . danger , div . error ,
div . hint , div . important , div . note , div . tip , div . warning {
margin : 2 em ;
border : medium outset ;
padding : 1 em }
div . admonition p . admonition-title , div . hint p . admonition-title ,
div . important p . admonition-title , div . note p . admonition-title ,
div . tip p . admonition-title {
font-weight : bold ;
font-family : sans-serif }
div . attention p . admonition-title , div . caution p . admonition-title ,
div . danger p . admonition-title , div . error p . admonition-title ,
div . warning p . admonition-title {
color : red ;
font-weight : bold ;
font-family : sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div . dedication {
margin : 2 em 5 em ;
text-align : center ;
font-style : italic }
div . dedication p . topic-title {
font-weight : bold ;
font-style : normal }
div . figure {
margin-left : 2 em ;
margin-right : 2 em }
div . footer , div . header {
clear : both ;
font-size : smaller }
div . line-block {
display : block ;
margin-top : 1 em ;
margin-bottom : 1 em }
div . line-block div . line-block {
margin-top : 0 ;
margin-bottom : 0 ;
margin-left : 1.5 em }
div . sidebar {
margin-left : 1 em ;
border : medium outset ;
padding : 1 em ;
background-color : #ffffee ;
width : 40 % ;
float : right ;
clear : right }
div . sidebar p . rubric {
font-family : sans-serif ;
font-size : medium }
div . system-messages {
margin : 5 em }
div . system-messages h1 {
color : red }
div . system-message {
border : medium outset ;
padding : 1 em }
div . system-message p . system-message-title {
color : red ;
font-weight : bold }
div . topic {
margin : 2 em }
h1 . section-subtitle , h2 . section-subtitle , h3 . section-subtitle ,
h4 . section-subtitle , h5 . section-subtitle , h6 . section-subtitle {
margin-top : 0.4 em }
h1 . title {
text-align : center }
h2 . subtitle {
text-align : center }
hr . docutils {
width : 75 % }
img . align-left {
clear : left }
img . align-right {
clear : right }
ol . simple , ul . simple {
margin-bottom : 1 em }
ol . arabic {
list-style : decimal }
ol . loweralpha {
list-style : lower-alpha }
ol . upperalpha {
list-style : upper-alpha }
ol . lowerroman {
list-style : lower-roman }
ol . upperroman {
list-style : upper-roman }
p . attribution {
text-align : right ;
margin-left : 50 % }
p . caption {
font-style : italic }
p . credits {
font-style : italic ;
font-size : smaller }
p . label {
white-space : nowrap }
p . rubric {
font-weight : bold ;
font-size : larger ;
color : maroon ;
text-align : center }
p . sidebar-title {
font-family : sans-serif ;
font-weight : bold ;
font-size : larger }
p . sidebar-subtitle {
font-family : sans-serif ;
font-weight : bold }
p . topic-title {
font-weight : bold }
pre . address {
margin-bottom : 0 ;
margin-top : 0 ;
font-family : serif ;
font-size : 100 % }
pre . literal-block , pre . doctest-block {
margin-left : 2 em ;
margin-right : 2 em ;
background-color : #eeeeee }
span . classifier {
font-family : sans-serif ;
font-style : oblique }
span . classifier-delimiter {
font-family : sans-serif ;
font-weight : bold }
span . interpreted {
font-family : sans-serif }
span . option {
white-space : nowrap }
span . pre {
white-space : pre }
span . problematic {
color : red }
span . section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size : 80 % }
table . citation {
border-left : solid 1 px gray ;
margin-left : 1 px }
table . docinfo {
margin : 2 em 4 em }
table . docutils {
margin-top : 0.5 em ;
margin-bottom : 0.5 em }
table . footnote {
border-left : solid 1 px black ;
margin-left : 1 px }
table . docutils td , table . docutils th ,
table . docinfo td , table . docinfo th {
padding-left : 0.5 em ;
padding-right : 0.5 em ;
vertical-align : top }
table . docutils th . field-name , table . docinfo th . docinfo-name {
font-weight : bold ;
text-align : left ;
white-space : nowrap ;
padding-left : 0 }
h1 tt . docutils , h2 tt . docutils , h3 tt . docutils ,
h4 tt . docutils , h5 tt . docutils , h6 tt . docutils {
font-size : 100 % }
tt . docutils {
background-color : #eeeeee }
ul . auto-toc {
list-style-type : none }
</ style >
2004-01-27 17:03:46 +00:00
</ head >
< body >
< div class = "document" >
2006-09-11 22:08:18 +00:00
<!-- Distributed under 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) -->
2004-01-27 17:03:46 +00:00
<!-- Version 1.4 of this ReStructuredText document corresponds to
n1530_, the paper accepted by the LWG for TR1. -->
2006-09-11 22:08:18 +00:00
<!-- Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. -->
2004-01-27 17:03:46 +00:00
< pre class = "literal-block" >
template <
class Derived
, class Base
2004-11-02 14:31:27 +00:00
, class Value = use_default
, class CategoryOrTraversal = use_default
, class Reference = use_default
2004-01-27 17:03:46 +00:00
, class Difference = use_default
>
2006-09-11 22:08:18 +00:00
class iterator_adaptor
2004-11-02 14:31:27 +00:00
: public iterator_facade< Derived, < em > V'</ em > , < em > C'</ em > , < em > R'</ em > , < em > D'</ em > > // see < a class = "reference" href = "#base-parameters" > details</ a >
2004-01-27 17:03:46 +00:00
{
friend class iterator_core_access;
public:
iterator_adaptor();
2006-02-01 23:33:32 +00:00
explicit iterator_adaptor(Base const& iter);
typedef Base base_type;
2004-11-02 14:31:27 +00:00
Base const& base() const;
2004-01-27 17:03:46 +00:00
protected:
2004-11-02 14:31:27 +00:00
typedef iterator_adaptor iterator_adaptor_;
2004-01-27 17:03:46 +00:00
Base const& base_reference() const;
Base& base_reference();
2006-09-11 22:08:18 +00:00
private: // Core iterator interface for iterator_facade.
2004-01-27 17:03:46 +00:00
typename iterator_adaptor::reference dereference() const;
template <
class OtherDerived, class OtherIterator, class V, class C, class R, class D
2006-09-11 22:08:18 +00:00
>
2004-01-27 17:03:46 +00:00
bool equal(iterator_adaptor< OtherDerived, OtherIterator, V, C, R, D> const& x) const;
void advance(typename iterator_adaptor::difference_type n);
void increment();
void decrement();
template <
class OtherDerived, class OtherIterator, class V, class C, class R, class D
2006-09-11 22:08:18 +00:00
>
2004-01-27 17:03:46 +00:00
typename iterator_adaptor::difference_type distance_to(
iterator_adaptor< OtherDerived, OtherIterator, V, C, R, D> const& y) const;
private:
Base m_iterator; // exposition only
};
</ pre >
2006-09-11 22:08:18 +00:00
< div class = "section" >
< h1 >< a id = "iterator-adaptor-requirements" name = "iterator-adaptor-requirements" >< span id = "requirements" ></ span >< tt class = "docutils literal" >< span class = "pre" > iterator_adaptor</ span ></ tt > requirements</ a ></ h1 >
2006-02-01 23:33:32 +00:00
< p >< tt class = "docutils literal" >< span class = "pre" > static_cast< Derived*> (iterator_adaptor*)</ span ></ tt > shall be well-formed.
The < tt class = "docutils literal" >< span class = "pre" > Base</ span ></ tt > argument shall be Assignable and Copy Constructible.</ p >
</ div >
2006-09-11 22:08:18 +00:00
< div class = "section" >
< h1 >< a id = "iterator-adaptor-base-class-parameters" name = "iterator-adaptor-base-class-parameters" >< span id = "base-parameters" ></ span >< tt class = "docutils literal" >< span class = "pre" > iterator_adaptor</ span ></ tt > base class parameters</ a ></ h1 >
2006-02-01 23:33:32 +00:00
< p > The < em > V'</ em > , < em > C'</ em > , < em > R'</ em > , and < em > D'</ em > parameters of the < tt class = "docutils literal" >< span class = "pre" > iterator_facade</ span ></ tt >
used as a base class in the summary of < tt class = "docutils literal" >< span class = "pre" > iterator_adaptor</ span ></ tt >
2004-01-27 17:03:46 +00:00
above are defined as follows:</ p >
< pre class = "literal-block" >
2004-11-02 14:31:27 +00:00
< em > V'</ em > = if (Value is use_default)
2004-01-27 17:03:46 +00:00
return iterator_traits< Base> ::value_type
else
return Value
2004-11-02 14:31:27 +00:00
< em > C'</ em > = if (CategoryOrTraversal is use_default)
2004-01-27 17:03:46 +00:00
return iterator_traversal< Base> ::type
else
return CategoryOrTraversal
2004-11-02 14:31:27 +00:00
< em > R'</ em > = if (Reference is use_default)
2004-01-27 17:03:46 +00:00
if (Value is use_default)
return iterator_traits< Base> ::reference
else
return Value&
else
return Reference
2004-11-02 14:31:27 +00:00
< em > D'</ em > = if (Difference is use_default)
2004-01-27 17:03:46 +00:00
return iterator_traits< Base> ::difference_type
else
return Difference
</ pre >
2004-11-02 14:31:27 +00:00
<!-- ``iterator_adaptor`` models
- - - - - - - - - - - - - - - - - - - - - - - - - - -
In order for ``Derived`` to model the iterator concepts corresponding
to ``iterator_traits<Derived>::iterator_category``, the expressions
involving ``m_iterator`` in the specifications of those private member
functions of ``iterator_adaptor`` that may be called by
``iterator_facade<Derived, V, C, R, D>`` in evaluating any valid
expression involving ``Derived`` in those concepts' requirements. -->
<!-- The above is confusing and needs a rewrite. -JGS -->
<!-- That's why it's removed. We're embracing inheritance, remember? -->
2004-01-27 17:03:46 +00:00
</ div >
2006-09-11 22:08:18 +00:00
< div class = "section" >
< h1 >< a id = "iterator-adaptor-public-operations" name = "iterator-adaptor-public-operations" >< tt class = "docutils literal" >< span class = "pre" > iterator_adaptor</ span ></ tt > public operations</ a ></ h1 >
2006-02-01 23:33:32 +00:00
< p >< tt class = "docutils literal" >< span class = "pre" > iterator_adaptor();</ span ></ tt ></ p >
< table class = "docutils field-list" frame = "void" rules = "none" >
2004-01-27 17:03:46 +00:00
< col class = "field-name" />
< col class = "field-body" />
< tbody valign = "top" >
2006-02-01 23:33:32 +00:00
< tr class = "field" >< th class = "field-name" > Requires:</ th >< td class = "field-body" > The < tt class = "docutils literal" >< span class = "pre" > Base</ span ></ tt > type must be Default Constructible.</ td >
2004-01-27 17:03:46 +00:00
</ tr >
2006-09-11 22:08:18 +00:00
< tr class = "field" >< th class = "field-name" > Returns:</ th >< td class = "field-body" > An instance of < tt class = "docutils literal" >< span class = "pre" > iterator_adaptor</ span ></ tt > with
2006-02-01 23:33:32 +00:00
< tt class = "docutils literal" >< span class = "pre" > m_iterator</ span ></ tt > default constructed.</ td >
2004-01-27 17:03:46 +00:00
</ tr >
</ tbody >
</ table >
2006-02-01 23:33:32 +00:00
< p >< tt class = "docutils literal" >< span class = "pre" > explicit</ span > < span class = "pre" > iterator_adaptor(Base</ span > < span class = "pre" > const& </ span > < span class = "pre" > iter);</ span ></ tt ></ p >
< table class = "docutils field-list" frame = "void" rules = "none" >
2004-01-27 17:03:46 +00:00
< col class = "field-name" />
< col class = "field-body" />
< tbody valign = "top" >
2006-02-01 23:33:32 +00:00
< tr class = "field" >< th class = "field-name" > Returns:</ th >< td class = "field-body" > An instance of < tt class = "docutils literal" >< span class = "pre" > iterator_adaptor</ span ></ tt > with
< tt class = "docutils literal" >< span class = "pre" > m_iterator</ span ></ tt > copy constructed from < tt class = "docutils literal" >< span class = "pre" > iter</ span ></ tt > .</ td >
2004-01-27 17:03:46 +00:00
</ tr >
</ tbody >
</ table >
2006-02-01 23:33:32 +00:00
< p >< tt class = "docutils literal" >< span class = "pre" > Base</ span > < span class = "pre" > const& </ span > < span class = "pre" > base()</ span > < span class = "pre" > const;</ span ></ tt ></ p >
< table class = "docutils field-list" frame = "void" rules = "none" >
2004-01-27 17:03:46 +00:00
< col class = "field-name" />
< col class = "field-body" />
< tbody valign = "top" >
2006-02-01 23:33:32 +00:00
< tr class = "field" >< th class = "field-name" > Returns:</ th >< td class = "field-body" >< tt class = "docutils literal" >< span class = "pre" > m_iterator</ span ></ tt ></ td >
2004-01-27 17:03:46 +00:00
</ tr >
</ tbody >
</ table >
</ div >
2006-09-11 22:08:18 +00:00
< div class = "section" >
< h1 >< a id = "iterator-adaptor-protected-member-functions" name = "iterator-adaptor-protected-member-functions" >< tt class = "docutils literal" >< span class = "pre" > iterator_adaptor</ span ></ tt > protected member functions</ a ></ h1 >
2006-02-01 23:33:32 +00:00
< p >< tt class = "docutils literal" >< span class = "pre" > Base</ span > < span class = "pre" > const& </ span > < span class = "pre" > base_reference()</ span > < span class = "pre" > const;</ span ></ tt ></ p >
< table class = "docutils field-list" frame = "void" rules = "none" >
2004-01-27 17:03:46 +00:00
< col class = "field-name" />
< col class = "field-body" />
< tbody valign = "top" >
2006-02-01 23:33:32 +00:00
< tr class = "field" >< th class = "field-name" > Returns:</ th >< td class = "field-body" > A const reference to < tt class = "docutils literal" >< span class = "pre" > m_iterator</ span ></ tt > .</ td >
2004-01-27 17:03:46 +00:00
</ tr >
</ tbody >
</ table >
2006-02-01 23:33:32 +00:00
< p >< tt class = "docutils literal" >< span class = "pre" > Base& </ span > < span class = "pre" > base_reference();</ span ></ tt ></ p >
< table class = "docutils field-list" frame = "void" rules = "none" >
2004-01-27 17:03:46 +00:00
< col class = "field-name" />
< col class = "field-body" />
< tbody valign = "top" >
2006-02-01 23:33:32 +00:00
< tr class = "field" >< th class = "field-name" > Returns:</ th >< td class = "field-body" > A non-const reference to < tt class = "docutils literal" >< span class = "pre" > m_iterator</ span ></ tt > .</ td >
2004-01-27 17:03:46 +00:00
</ tr >
</ tbody >
</ table >
</ div >
2006-09-11 22:08:18 +00:00
< div class = "section" >
< h1 >< a id = "iterator-adaptor-private-member-functions" name = "iterator-adaptor-private-member-functions" >< tt class = "docutils literal" >< span class = "pre" > iterator_adaptor</ span ></ tt > private member functions</ a ></ h1 >
2006-02-01 23:33:32 +00:00
< p >< tt class = "docutils literal" >< span class = "pre" > typename</ span > < span class = "pre" > iterator_adaptor::reference</ span > < span class = "pre" > dereference()</ span > < span class = "pre" > const;</ span ></ tt ></ p >
< table class = "docutils field-list" frame = "void" rules = "none" >
2004-01-27 17:03:46 +00:00
< col class = "field-name" />
< col class = "field-body" />
< tbody valign = "top" >
2006-02-01 23:33:32 +00:00
< tr class = "field" >< th class = "field-name" > Returns:</ th >< td class = "field-body" >< tt class = "docutils literal" >< span class = "pre" > *m_iterator</ span ></ tt ></ td >
2004-01-27 17:03:46 +00:00
</ tr >
</ tbody >
</ table >
< pre class = "literal-block" >
template <
class OtherDerived, class OtherIterator, class V, class C, class R, class D
2006-09-11 22:08:18 +00:00
>
2004-01-27 17:03:46 +00:00
bool equal(iterator_adaptor< OtherDerived, OtherIterator, V, C, R, D> const& x) const;
</ pre >
2006-02-01 23:33:32 +00:00
< table class = "docutils field-list" frame = "void" rules = "none" >
2004-01-27 17:03:46 +00:00
< col class = "field-name" />
< col class = "field-body" />
< tbody valign = "top" >
2006-02-01 23:33:32 +00:00
< tr class = "field" >< th class = "field-name" > Returns:</ th >< td class = "field-body" >< tt class = "docutils literal" >< span class = "pre" > m_iterator</ span > < span class = "pre" > ==</ span > < span class = "pre" > x.base()</ span ></ tt ></ td >
2004-01-27 17:03:46 +00:00
</ tr >
</ tbody >
</ table >
2006-02-01 23:33:32 +00:00
< p >< tt class = "docutils literal" >< span class = "pre" > void</ span > < span class = "pre" > advance(typename</ span > < span class = "pre" > iterator_adaptor::difference_type</ span > < span class = "pre" > n);</ span ></ tt ></ p >
< table class = "docutils field-list" frame = "void" rules = "none" >
2004-01-27 17:03:46 +00:00
< col class = "field-name" />
< col class = "field-body" />
< tbody valign = "top" >
2006-02-01 23:33:32 +00:00
< tr class = "field" >< th class = "field-name" > Effects:</ th >< td class = "field-body" >< tt class = "docutils literal" >< span class = "pre" > m_iterator</ span > < span class = "pre" > +=</ span > < span class = "pre" > n;</ span ></ tt ></ td >
2004-01-27 17:03:46 +00:00
</ tr >
</ tbody >
</ table >
2006-02-01 23:33:32 +00:00
< p >< tt class = "docutils literal" >< span class = "pre" > void</ span > < span class = "pre" > increment();</ span ></ tt ></ p >
< table class = "docutils field-list" frame = "void" rules = "none" >
2004-01-27 17:03:46 +00:00
< col class = "field-name" />
< col class = "field-body" />
< tbody valign = "top" >
2006-02-01 23:33:32 +00:00
< tr class = "field" >< th class = "field-name" > Effects:</ th >< td class = "field-body" >< tt class = "docutils literal" >< span class = "pre" > ++m_iterator;</ span ></ tt ></ td >
2004-01-27 17:03:46 +00:00
</ tr >
</ tbody >
</ table >
2006-02-01 23:33:32 +00:00
< p >< tt class = "docutils literal" >< span class = "pre" > void</ span > < span class = "pre" > decrement();</ span ></ tt ></ p >
< table class = "docutils field-list" frame = "void" rules = "none" >
2004-01-27 17:03:46 +00:00
< col class = "field-name" />
< col class = "field-body" />
< tbody valign = "top" >
2006-02-01 23:33:32 +00:00
< tr class = "field" >< th class = "field-name" > Effects:</ th >< td class = "field-body" >< tt class = "docutils literal" >< span class = "pre" > --m_iterator;</ span ></ tt ></ td >
2004-01-27 17:03:46 +00:00
</ tr >
</ tbody >
</ table >
< pre class = "literal-block" >
template <
class OtherDerived, class OtherIterator, class V, class C, class R, class D
2006-09-11 22:08:18 +00:00
>
2004-01-27 17:03:46 +00:00
typename iterator_adaptor::difference_type distance_to(
iterator_adaptor< OtherDerived, OtherIterator, V, C, R, D> const& y) const;
</ pre >
2006-02-01 23:33:32 +00:00
< table class = "docutils field-list" frame = "void" rules = "none" >
2004-01-27 17:03:46 +00:00
< col class = "field-name" />
< col class = "field-body" />
< tbody valign = "top" >
2006-02-01 23:33:32 +00:00
< tr class = "field" >< th class = "field-name" > Returns:</ th >< td class = "field-body" >< tt class = "docutils literal" >< span class = "pre" > y.base()</ span > < span class = "pre" > -</ span > < span class = "pre" > m_iterator</ span ></ tt ></ td >
2004-01-27 17:03:46 +00:00
</ tr >
</ tbody >
</ table >
</ div >
</ div >
</ body >
</ html >