2003-08-05 19:42:37 +00:00
|
|
|
::
|
|
|
|
|
|
|
|
template <
|
|
|
|
class Iterator
|
|
|
|
, class Value = use_default
|
2003-12-16 22:10:51 +00:00
|
|
|
, class CategoryOrTraversal = use_default
|
2003-08-05 19:42:37 +00:00
|
|
|
, class Reference = use_default
|
|
|
|
, class Difference = use_default
|
|
|
|
>
|
|
|
|
class indirect_iterator
|
2003-12-16 22:10:51 +00:00
|
|
|
: public iterator_adaptor<
|
|
|
|
indirect_iterator<Iterator, Value, Access, Traversal,
|
2003-12-16 22:15:48 +00:00
|
|
|
Reference, Difference>,
|
2003-12-16 22:10:51 +00:00
|
|
|
Iterator,
|
|
|
|
/* Value = see below */,
|
|
|
|
CategoryOrTraversal,
|
|
|
|
Reference,
|
|
|
|
Difference>
|
2003-08-05 19:42:37 +00:00
|
|
|
{
|
|
|
|
friend class iterator_core_access;
|
|
|
|
public:
|
|
|
|
indirect_iterator();
|
|
|
|
indirect_iterator(Iterator x);
|
2003-12-16 22:10:51 +00:00
|
|
|
|
2003-08-05 19:42:37 +00:00
|
|
|
template <
|
2003-12-16 22:10:51 +00:00
|
|
|
class Iterator2, class Value2, class Category2
|
2003-08-05 19:42:37 +00:00
|
|
|
, class Reference2, class Difference2
|
|
|
|
>
|
|
|
|
indirect_iterator(
|
|
|
|
indirect_iterator<
|
2003-12-16 22:10:51 +00:00
|
|
|
Iterator2, Value2, Category2, Reference2, Difference2
|
2003-08-05 19:42:37 +00:00
|
|
|
> const& y
|
|
|
|
, typename enable_if_convertible<Iterator2, Iterator>::type* = 0 // exposition
|
|
|
|
);
|
|
|
|
private: // as-if specification
|
|
|
|
typename indirect_iterator::reference dereference() const
|
|
|
|
{
|
|
|
|
return **this->base();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2003-12-17 19:32:31 +00:00
|
|
|
template <class Dereferenceable>
|
|
|
|
struct referent {
|
|
|
|
typedef /* see below */ type;
|
|
|
|
};
|
2003-08-05 19:42:37 +00:00
|
|
|
|
2003-12-16 22:10:51 +00:00
|
|
|
|
2003-12-17 19:32:31 +00:00
|
|
|
If ``Value`` is not ``use_default`` then the the argument for the
|
|
|
|
``iterator_adaptor`` base class' ``Value`` parameter is ``Value`` with
|
|
|
|
cv-qualifiers removed. If ``Value`` is ``use_default``, then the
|
|
|
|
argument for the ``iterator_adaptor`` base class' ``Value`` parameter
|
|
|
|
is computed as follows. We use the abbreviation
|
|
|
|
``V=iterator_traits<Iterator>::value_type`` and ``v`` is an object of
|
|
|
|
type ``V``.::
|
2003-08-05 19:42:37 +00:00
|
|
|
|
2003-12-17 19:32:31 +00:00
|
|
|
if (*v returns a constant lvalue or an rvalue) then
|
|
|
|
referent<V>::type
|
|
|
|
else
|
|
|
|
add_const<referent<V>::type>::type
|
2003-08-05 19:42:37 +00:00
|
|
|
|
2003-12-17 19:32:31 +00:00
|
|
|
The algorithm for the ``type`` member of ``referent`` traits class is
|
|
|
|
as follows::
|
2003-08-05 19:42:37 +00:00
|
|
|
|
2003-12-17 19:32:31 +00:00
|
|
|
if (Dereferenceable is a class and has member element_type)
|
|
|
|
Dereferenceable::element_type
|
|
|
|
else
|
|
|
|
iterator_traits<Dereferenceable>::value_type
|
2003-08-05 19:42:37 +00:00
|
|
|
|
|
|
|
|
2003-12-17 19:32:31 +00:00
|
|
|
``indirect_iterator`` requirements
|
|
|
|
..................................
|
|
|
|
|
2003-12-19 16:47:47 +00:00
|
|
|
The ``CategoryOrTraversal`` argument shall be one of the standard
|
|
|
|
iterator tags or ``use_default``. If ``CategoryOrTraversal`` is an
|
|
|
|
iterator tag, ``indirect_iterator`` satisfies the requirements
|
2003-12-19 21:20:36 +00:00
|
|
|
corresponding to the iterator tag. The template parameter
|
|
|
|
``Iterator`` argument shall meet the traversal requirements
|
|
|
|
corresponding to the iterator tag and the requirements of Readable
|
|
|
|
Iterator. If ``CategoryOrTraversal`` is ``use_default`` then
|
|
|
|
``indirect_iterator`` satisfies the requirements of the most refined
|
|
|
|
standard traversal concept that is satisfied by the ``Iterator``
|
|
|
|
argument. In this case the ``Iterator`` argument shall meet the
|
|
|
|
requirements of Readable Iterator.
|
2003-12-19 16:47:47 +00:00
|
|
|
|
2003-12-19 21:20:36 +00:00
|
|
|
The expression ``*v``, where ``v`` is an object of type
|
2003-12-19 16:47:47 +00:00
|
|
|
``iterator_traits<Iterator>::value_type``, must be a valid expression
|
2003-12-19 21:20:36 +00:00
|
|
|
and must be convertible to ``iterator_adaptor::reference`` Also, there
|
|
|
|
are further requirements on the
|
2003-12-19 16:47:47 +00:00
|
|
|
``iterator_traits<Iterator>::value_type`` if the ``Value`` parameter
|
|
|
|
is not ``use_default``, as implied by the algorithm for deducing the
|
|
|
|
default.
|
2003-08-05 19:42:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
``indirect_iterator`` operations
|
|
|
|
................................
|
|
|
|
|
|
|
|
``indirect_iterator();``
|
|
|
|
|
|
|
|
:Requires: ``Iterator`` must be Default Constructible.
|
2003-12-16 22:10:51 +00:00
|
|
|
:Returns: An instance of ``indirect_iterator`` with
|
|
|
|
a default-constructed ``iterator_adaptor`` subobject.
|
2003-08-05 19:42:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
``indirect_iterator(Iterator x);``
|
|
|
|
|
|
|
|
:Returns: An instance of ``indirect_iterator`` with
|
|
|
|
the ``iterator_adaptor`` subobject copy constructed from ``x``.
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
template <
|
2003-09-22 19:55:01 +00:00
|
|
|
class Iterator2, class Value2, unsigned Access, class Traversal
|
2003-08-05 19:42:37 +00:00
|
|
|
, class Reference2, class Difference2
|
|
|
|
>
|
|
|
|
indirect_iterator(
|
|
|
|
indirect_iterator<
|
2003-09-22 19:55:01 +00:00
|
|
|
Iterator2, Value2, Access, Traversal, Reference2, Difference2
|
2003-08-05 19:42:37 +00:00
|
|
|
> const& y
|
|
|
|
, typename enable_if_convertible<Iterator2, Iterator>::type* = 0 // exposition
|
|
|
|
);
|
|
|
|
|
|
|
|
:Requires: ``Iterator2`` is implicitly convertible to ``Iterator``.
|
2003-12-16 22:10:51 +00:00
|
|
|
:Returns: An instance of ``indirect_iterator`` whose
|
2003-12-16 22:15:48 +00:00
|
|
|
``iterator_adaptor`` subobject is constructed from ``y.base()``.
|
2003-12-16 22:10:51 +00:00
|
|
|
|
2003-08-05 19:42:37 +00:00
|
|
|
|