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" />
2007-06-07 20:53:46 +00:00
< meta name = "generator" content = "Docutils 0.3.6: http://docutils.sourceforge.net/" />
2004-11-02 14:31:27 +00:00
< title ></ title >
2007-06-07 20:53:46 +00:00
< link rel = "stylesheet" href = "default.css" type = "text/css" />
2004-01-27 17:03:46 +00:00
</ head >
< body >
< div class = "document" >
< pre class = "literal-block" >
template <
class Iterator
, class Value = use_default
, class CategoryOrTraversal = use_default
, class Reference = use_default
, class Difference = use_default
>
class indirect_iterator
{
public:
typedef /* see below */ value_type;
typedef /* see below */ reference;
typedef /* see below */ pointer;
typedef /* see below */ difference_type;
typedef /* see below */ iterator_category;
indirect_iterator();
indirect_iterator(Iterator x);
template <
class Iterator2, class Value2, class Category2
, class Reference2, class Difference2
>
indirect_iterator(
indirect_iterator<
Iterator2, Value2, Category2, Reference2, Difference2
> const& y
, typename enable_if_convertible< Iterator2, Iterator> ::type* = 0 // exposition
);
2004-11-02 14:31:27 +00:00
Iterator const& base() const;
reference operator*() const;
indirect_iterator& operator++();
indirect_iterator& operator--();
private:
Iterator m_iterator; // exposition
2004-01-27 17:03:46 +00:00
};
</ pre >
2007-06-07 20:53:46 +00:00
< p > The member types of < tt class = "literal" >< span class = "pre" > indirect_iterator</ span ></ tt > are defined according to
the following pseudo-code, where < tt class = "literal" >< span class = "pre" > V</ span ></ tt > is
< tt class = "literal" >< span class = "pre" > iterator_traits< Iterator> ::value_type</ span ></ tt ></ p >
2004-01-27 17:03:46 +00:00
< pre class = "literal-block" >
if (Value is use_default) then
2004-11-02 14:31:27 +00:00
typedef remove_const< pointee< V> ::type> ::type value_type;
2004-01-27 17:03:46 +00:00
else
typedef remove_const< Value> ::type value_type;
if (Reference is use_default) then
2004-11-02 14:31:27 +00:00
if (Value is use_default) then
typedef indirect_reference< V> ::type reference;
else
typedef Value& reference;
2004-01-27 17:03:46 +00:00
else
typedef Reference reference;
2007-06-07 20:53:46 +00:00
if (Value is use_default) then
2004-11-02 14:31:27 +00:00
typedef pointee< V> ::type* pointer;
2007-06-07 20:53:46 +00:00
else
2004-11-02 14:31:27 +00:00
typedef Value* pointer;
2004-01-27 17:03:46 +00:00
if (Difference is use_default)
typedef iterator_traits< Iterator> ::difference_type difference_type;
else
typedef Difference difference_type;
2004-11-02 14:31:27 +00:00
if (CategoryOrTraversal is use_default)
typedef < em > iterator-category</ em > (
iterator_traversal< Iterator> ::type,``reference``,``value_type``
) iterator_category;
else
typedef < em > iterator-category</ em > (
CategoryOrTraversal,``reference``,``value_type``
) iterator_category;
2004-01-27 17:03:46 +00:00
</ pre >
2007-06-07 20:53:46 +00:00
< div class = "section" id = "indirect-iterator-requirements" >
< h1 >< a name = "indirect-iterator-requirements" >< tt class = "literal" >< span class = "pre" > indirect_iterator</ span ></ tt > requirements</ a ></ h1 >
< 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< Iterator> ::value_type</ span ></ tt > , shall be valid
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 >
2004-11-02 14:31:27 +00:00
< p > [Note: there are further requirements on the
2007-06-07 20:53:46 +00:00
< tt class = "literal" >< span class = "pre" > iterator_traits< Iterator> ::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 >
2004-01-27 17:03:46 +00:00
</ div >
2007-06-07 20:53:46 +00:00
< div class = "section" id = "indirect-iterator-models" >
< h1 >< a name = "indirect-iterator-models" >< tt class = "literal" >< span class = "pre" > indirect_iterator</ span ></ tt > models</ a ></ h1 >
< p > In addition to the concepts indicated by < tt class = "literal" >< span class = "pre" > iterator_category</ span ></ tt >
and by < tt class = "literal" >< span class = "pre" > iterator_traversal< indirect_iterator> ::type</ 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< Iterator> ::value_type</ span ></ tt > :</ p >
2004-11-02 14:31:27 +00:00
< blockquote >
< ul class = "simple" >
2007-06-07 20:53:46 +00:00
< 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 >
2004-11-02 14:31:27 +00:00
</ ul >
</ blockquote >
2007-06-07 20:53:46 +00:00
< p >< tt class = "literal" >< span class = "pre" > indirect_iterator< X,V1,C1,R1,D1> </ span ></ tt > is interoperable with
< tt class = "literal" >< span class = "pre" > indirect_iterator< Y,V2,C2,R2,D2> </ span ></ tt > if and only if < tt class = "literal" >< span class = "pre" > X</ span ></ tt > is
interoperable with < tt class = "literal" >< span class = "pre" > Y</ span ></ tt > .</ p >
2004-01-27 17:03:46 +00:00
</ div >
2007-06-07 20:53:46 +00:00
< div class = "section" id = "indirect-iterator-operations" >
< h1 >< a name = "indirect-iterator-operations" >< tt class = "literal" >< span class = "pre" > indirect_iterator</ span ></ tt > operations</ a ></ h1 >
2004-11-02 14:31:27 +00:00
< p > In addition to the operations required by the concepts described
2007-06-07 20:53:46 +00:00
above, specializations of < tt class = "literal" >< span class = "pre" > indirect_iterator</ span ></ tt > provide the
2004-11-02 14:31:27 +00:00
following operations.</ p >
2007-06-07 20:53:46 +00:00
< p >< tt class = "literal" >< span class = "pre" > indirect_iterator();</ span ></ tt ></ p >
< table class = "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" >
2007-06-07 20:53:46 +00:00
< tr class = "field" >< th class = "field-name" > Requires:</ th >< td class = "field-body" >< tt class = "literal" >< span class = "pre" > Iterator</ span ></ tt > must be Default Constructible.</ td >
2004-01-27 17:03:46 +00:00
</ tr >
2007-06-07 20:53:46 +00:00
< tr class = "field" >< th class = "field-name" > Effects:</ th >< td class = "field-body" > Constructs an instance of < tt class = "literal" >< span class = "pre" > indirect_iterator</ span ></ tt > with
a default-constructed < tt class = "literal" >< span class = "pre" > m_iterator</ span ></ tt > .</ td >
2004-01-27 17:03:46 +00:00
</ tr >
</ tbody >
</ table >
2007-06-07 20:53:46 +00:00
< p >< tt class = "literal" >< span class = "pre" > indirect_iterator(Iterator</ span > < span class = "pre" > x);</ span ></ tt ></ p >
< table class = "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" >
2007-06-07 20:53:46 +00:00
< tr class = "field" >< th class = "field-name" > Effects:</ th >< td class = "field-body" > Constructs an instance of < tt class = "literal" >< span class = "pre" > indirect_iterator</ span ></ tt > with
< tt class = "literal" >< span class = "pre" > m_iterator</ span ></ tt > copy constructed from < tt class = "literal" >< span class = "pre" > x</ span ></ tt > .</ td >
2004-01-27 17:03:46 +00:00
</ tr >
</ tbody >
</ table >
< pre class = "literal-block" >
template <
class Iterator2, class Value2, unsigned Access, class Traversal
, class Reference2, class Difference2
>
indirect_iterator(
indirect_iterator<
Iterator2, Value2, Access, Traversal, Reference2, Difference2
> const& y
, typename enable_if_convertible< Iterator2, Iterator> ::type* = 0 // exposition
);
</ pre >
2007-06-07 20:53:46 +00:00
< table class = "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" >
2007-06-07 20:53:46 +00:00
< tr class = "field" >< th class = "field-name" > Requires:</ th >< td class = "field-body" >< tt class = "literal" >< span class = "pre" > Iterator2</ span ></ tt > is implicitly convertible to < tt class = "literal" >< span class = "pre" > Iterator</ span ></ tt > .</ td >
2004-01-27 17:03:46 +00:00
</ tr >
2007-06-07 20:53:46 +00:00
< tr class = "field" >< th class = "field-name" > Effects:</ th >< td class = "field-body" > Constructs an instance of < tt class = "literal" >< span class = "pre" > indirect_iterator</ span ></ tt > whose
< tt class = "literal" >< span class = "pre" > m_iterator</ span ></ tt > subobject is constructed from < tt class = "literal" >< span class = "pre" > y.base()</ span ></ tt > .</ td >
2004-11-02 14:31:27 +00:00
</ tr >
</ tbody >
</ table >
2007-06-07 20:53:46 +00:00
< p >< tt class = "literal" >< span class = "pre" > Iterator</ span > < span class = "pre" > const& </ span > < span class = "pre" > base()</ span > < span class = "pre" > const;</ span ></ tt ></ p >
< table class = "field-list" frame = "void" rules = "none" >
2004-11-02 14:31:27 +00:00
< col class = "field-name" />
< col class = "field-body" />
< tbody valign = "top" >
2007-06-07 20:53:46 +00:00
< tr class = "field" >< th class = "field-name" > Returns:</ th >< td class = "field-body" >< tt class = "literal" >< span class = "pre" > m_iterator</ span ></ tt ></ td >
2004-11-02 14:31:27 +00:00
</ tr >
</ tbody >
</ table >
2007-06-07 20:53:46 +00:00
< p >< tt class = "literal" >< span class = "pre" > reference</ span > < span class = "pre" > operator*()</ span > < span class = "pre" > const;</ span ></ tt ></ p >
< table class = "field-list" frame = "void" rules = "none" >
2004-11-02 14:31:27 +00:00
< col class = "field-name" />
< col class = "field-body" />
< tbody valign = "top" >
2007-06-07 20:53:46 +00:00
< tr class = "field" >< th class = "field-name" > Returns:</ th >< td class = "field-body" >< tt class = "literal" >< span class = "pre" > **m_iterator</ span ></ tt ></ td >
2004-11-02 14:31:27 +00:00
</ tr >
</ tbody >
</ table >
2007-06-07 20:53:46 +00:00
< p >< tt class = "literal" >< span class = "pre" > indirect_iterator& </ span > < span class = "pre" > operator++();</ span ></ tt ></ p >
< table class = "field-list" frame = "void" rules = "none" >
2004-11-02 14:31:27 +00:00
< col class = "field-name" />
< col class = "field-body" />
< tbody valign = "top" >
2007-06-07 20:53:46 +00:00
< tr class = "field" >< th class = "field-name" > Effects:</ th >< td class = "field-body" >< tt class = "literal" >< span class = "pre" > ++m_iterator</ span ></ tt ></ td >
2004-11-02 14:31:27 +00:00
</ tr >
2007-06-07 20:53:46 +00:00
< tr class = "field" >< th class = "field-name" > Returns:</ th >< td class = "field-body" >< tt class = "literal" >< span class = "pre" > *this</ span ></ tt ></ td >
2004-11-02 14:31:27 +00:00
</ tr >
</ tbody >
</ table >
2007-06-07 20:53:46 +00:00
< p >< tt class = "literal" >< span class = "pre" > indirect_iterator& </ span > < span class = "pre" > operator--();</ span ></ tt ></ p >
< table class = "field-list" frame = "void" rules = "none" >
2004-11-02 14:31:27 +00:00
< col class = "field-name" />
< col class = "field-body" />
< tbody valign = "top" >
2007-06-07 20:53:46 +00:00
< tr class = "field" >< th class = "field-name" > Effects:</ th >< td class = "field-body" >< tt class = "literal" >< span class = "pre" > --m_iterator</ span ></ tt ></ td >
2004-11-02 14:31:27 +00:00
</ tr >
2007-06-07 20:53:46 +00:00
< tr class = "field" >< th class = "field-name" > Returns:</ th >< td class = "field-body" >< tt class = "literal" >< span class = "pre" > *this</ span ></ tt ></ td >
2004-01-27 17:03:46 +00:00
</ tr >
</ tbody >
</ table >
</ div >
</ div >
2007-06-07 20:53:46 +00:00
< hr class = "footer" />
< div class = "footer" >
< a class = "reference" href = "indirect_iterator_ref.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 >
2004-01-27 17:03:46 +00:00
</ body >
</ html >