Made transform_iterator documentation refer to result_of.

[SVN r20123]
This commit is contained in:
Thomas Witt
2003-09-20 21:30:10 +00:00
parent 4968b50fc2
commit d9b4e41d5a

View File

@ -1,6 +1,6 @@
:: ::
template <class AdaptableUnaryFunction, template <class UnaryFunction,
class Iterator, class Iterator,
class Reference = use_default, class Reference = use_default,
class Value = use_default> class Value = use_default>
@ -10,50 +10,48 @@
friend class iterator_core_access; friend class iterator_core_access;
public: public:
transform_iterator(); transform_iterator();
transform_iterator(Iterator const& x, AdaptableUnaryFunction f); transform_iterator(Iterator const& x, UnaryFunction f);
template<class OtherIterator, class R2, class V2> template<class OtherIterator, class R2, class V2>
transform_iterator( transform_iterator(
transform_iterator<AdaptableUnaryFunction, OtherIterator, R2, V2> const& t transform_iterator<UnaryFunction, OtherIterator, R2, V2> const& t
, typename enable_if_convertible<OtherIterator, Iterator>::type* = 0 // exposition , typename enable_if_convertible<OtherIterator, Iterator>::type* = 0 // exposition
); );
AdaptableUnaryFunction functor() const; UnaryFunction functor() const;
private: private:
typename transform_iterator::value_type dereference() const; typename transform_iterator::value_type dereference() const;
AdaptableUnaryFunction m_f; UnaryFunction m_f;
}; };
``transform_iterator`` requirements ``transform_iterator`` requirements
................................... ...................................
The type ``AdaptableUnaryFunction`` must be Assignable, Copy The type ``UnaryFunction`` must be Assignable, Copy Constructible, and
Constructible, and the expression ``f(x)`` must be valid where ``f`` the expression ``f(*i)`` must be valid where ``f`` is an object of
is an object of type ``AdaptableUnaryFunction``, ``x`` is an object of type ``UnaryFunction``, ``i`` is an object of type ``Iterator``, and
type ``AdaptableUnaryFunction::argument_type``, and where the type of where the type of ``f(*i)`` must be
``f(x)`` must be ``AdaptableUnaryFunction::result_type``. ``result_of<UnaryFunction(iterator_traits<Iterator>::reference)>::type``.
The type ``Iterator`` must at least model Readable Iterator. The The type ``Iterator`` must at least model Readable Iterator. The
resulting ``transform_iterator`` models the most refined of the resulting ``transform_iterator`` models the most refined of the
following options that is also modeled by ``Iterator``. following options that is also modeled by ``Iterator``.
* Writable Lvalue Iterator if the ``result_type`` of the * Writable Lvalue Iterator if ``result_of<UnaryFunction(iterator_traits<Iterator>::reference)>::type`` is a non-const reference.
``AdaptableUnaryFunction`` is a non-const reference.
* Readable Lvalue Iterator if the ``result_type`` is a const * Readable Lvalue Iterator if ``result_of<UnaryFunction(iterator_traits<Iterator>::reference)>::type`` is a const
reference. reference.
* Readable Iterator otherwise. * Readable Iterator otherwise.
The ``transform_iterator`` models the most refined standard traversal The ``transform_iterator`` models the traversal
concept that is modeled by ``Iterator``. concept that is modeled by ``Iterator``.
The ``value_type`` of ``transform_iterator`` is The ``reference`` type of ``transform_iterator`` is
``remove_reference<result_type>::type``. The ``reference`` type is ``result_of<UnaryFunction(iterator_traits<Iterator>::reference)>::type``.
``result_type``. The ``value_type`` is ``remove_cv<remove_reference<reference> >::type``.
``transform_iterator`` public operations ``transform_iterator`` public operations
........................................ ........................................
@ -65,7 +63,7 @@ The ``value_type`` of ``transform_iterator`` is
and ``m_iterator`` default constructed. and ``m_iterator`` default constructed.
``transform_iterator(Iterator const& x, AdaptableUnaryFunction f);`` ``transform_iterator(Iterator const& x, UnaryFunction f);``
:Returns: An instance of ``transform_iterator`` with ``m_f`` :Returns: An instance of ``transform_iterator`` with ``m_f``
initialized to ``f`` and ``m_iterator`` initialized to ``x``. initialized to ``f`` and ``m_iterator`` initialized to ``x``.
@ -75,14 +73,14 @@ The ``value_type`` of ``transform_iterator`` is
template<class OtherIterator, class R2, class V2> template<class OtherIterator, class R2, class V2>
transform_iterator( transform_iterator(
transform_iterator<AdaptableUnaryFunction, OtherIterator, R2, V2> const& t transform_iterator<UnaryFunction, OtherIterator, R2, V2> const& t
, typename enable_if_convertible<OtherIterator, Iterator>::type* = 0 // exposition , typename enable_if_convertible<OtherIterator, Iterator>::type* = 0 // exposition
); );
:Returns: An instance of ``transform_iterator`` that is a copy of ``t``. :Returns: An instance of ``transform_iterator`` that is a copy of ``t``.
:Requires: ``OtherIterator`` is implicitly convertible to ``Iterator``. :Requires: ``OtherIterator`` is implicitly convertible to ``Iterator``.
``AdaptableUnaryFunction functor() const;`` ``UnaryFunction functor() const;``
:Returns: ``m_f`` :Returns: ``m_f``