mirror of
https://github.com/boostorg/iterator.git
synced 2025-05-12 05:51:37 +00:00
refs #5127 applying Michael Morin's patch for transform_iterator to trunk
[SVN r78121]
This commit is contained in:
parent
964a29979c
commit
ad90dac61d
@ -99,7 +99,7 @@ private:
|
|||||||
</pre>
|
</pre>
|
||||||
<p>If <tt class="docutils literal"><span class="pre">Reference</span></tt> is <tt class="docutils literal"><span class="pre">use_default</span></tt> then the <tt class="docutils literal"><span class="pre">reference</span></tt> member of
|
<p>If <tt class="docutils literal"><span class="pre">Reference</span></tt> is <tt class="docutils literal"><span class="pre">use_default</span></tt> then the <tt class="docutils literal"><span class="pre">reference</span></tt> member of
|
||||||
<tt class="docutils literal"><span class="pre">transform_iterator</span></tt> is
|
<tt class="docutils literal"><span class="pre">transform_iterator</span></tt> is
|
||||||
<tt class="docutils literal"><span class="pre">result_of<UnaryFunction(iterator_traits<Iterator>::reference)>::type</span></tt>.
|
<tt class="docutils literal"><span class="pre">result_of<const UnaryFunction(iterator_traits<Iterator>::reference)>::type</span></tt>.
|
||||||
Otherwise, <tt class="docutils literal"><span class="pre">reference</span></tt> is <tt class="docutils literal"><span class="pre">Reference</span></tt>.</p>
|
Otherwise, <tt class="docutils literal"><span class="pre">reference</span></tt> is <tt class="docutils literal"><span class="pre">Reference</span></tt>.</p>
|
||||||
<p>If <tt class="docutils literal"><span class="pre">Value</span></tt> is <tt class="docutils literal"><span class="pre">use_default</span></tt> then the <tt class="docutils literal"><span class="pre">value_type</span></tt> member is
|
<p>If <tt class="docutils literal"><span class="pre">Value</span></tt> is <tt class="docutils literal"><span class="pre">use_default</span></tt> then the <tt class="docutils literal"><span class="pre">value_type</span></tt> member is
|
||||||
<tt class="docutils literal"><span class="pre">remove_cv<remove_reference<reference></span> <span class="pre">>::type</span></tt>. Otherwise,
|
<tt class="docutils literal"><span class="pre">remove_cv<remove_reference<reference></span> <span class="pre">>::type</span></tt>. Otherwise,
|
||||||
@ -117,10 +117,10 @@ convertible to <tt class="docutils literal"><span class="pre">input_iterator_tag
|
|||||||
<div class="section" id="transform-iterator-requirements">
|
<div class="section" id="transform-iterator-requirements">
|
||||||
<h1><a class="toc-backref" href="#id3"><tt class="docutils literal"><span class="pre">transform_iterator</span></tt> requirements</a></h1>
|
<h1><a class="toc-backref" href="#id3"><tt class="docutils literal"><span class="pre">transform_iterator</span></tt> requirements</a></h1>
|
||||||
<p>The type <tt class="docutils literal"><span class="pre">UnaryFunction</span></tt> must be Assignable, Copy Constructible, and
|
<p>The type <tt class="docutils literal"><span class="pre">UnaryFunction</span></tt> must be Assignable, Copy Constructible, and
|
||||||
the expression <tt class="docutils literal"><span class="pre">f(*i)</span></tt> must be valid where <tt class="docutils literal"><span class="pre">f</span></tt> is an object of
|
the expression <tt class="docutils literal"><span class="pre">f(*i)</span></tt> must be valid where <tt class="docutils literal"><span class="pre">f</span></tt> is a const object of
|
||||||
type <tt class="docutils literal"><span class="pre">UnaryFunction</span></tt>, <tt class="docutils literal"><span class="pre">i</span></tt> is an object of type <tt class="docutils literal"><span class="pre">Iterator</span></tt>, and
|
type <tt class="docutils literal"><span class="pre">UnaryFunction</span></tt>, <tt class="docutils literal"><span class="pre">i</span></tt> is an object of type <tt class="docutils literal"><span class="pre">Iterator</span></tt>, and
|
||||||
where the type of <tt class="docutils literal"><span class="pre">f(*i)</span></tt> must be
|
where the type of <tt class="docutils literal"><span class="pre">f(*i)</span></tt> must be
|
||||||
<tt class="docutils literal"><span class="pre">result_of<UnaryFunction(iterator_traits<Iterator>::reference)>::type</span></tt>.</p>
|
<tt class="docutils literal"><span class="pre">result_of<const UnaryFunction(iterator_traits<Iterator>::reference)>::type</span></tt>.</p>
|
||||||
<p>The argument <tt class="docutils literal"><span class="pre">Iterator</span></tt> shall model Readable Iterator.</p>
|
<p>The argument <tt class="docutils literal"><span class="pre">Iterator</span></tt> shall model Readable Iterator.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="transform-iterator-models">
|
<div class="section" id="transform-iterator-models">
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
If ``Reference`` is ``use_default`` then the ``reference`` member of
|
If ``Reference`` is ``use_default`` then the ``reference`` member of
|
||||||
``transform_iterator`` is
|
``transform_iterator`` is
|
||||||
``result_of<UnaryFunction(iterator_traits<Iterator>::reference)>::type``.
|
``result_of<const UnaryFunction(iterator_traits<Iterator>::reference)>::type``.
|
||||||
Otherwise, ``reference`` is ``Reference``.
|
Otherwise, ``reference`` is ``Reference``.
|
||||||
|
|
||||||
If ``Value`` is ``use_default`` then the ``value_type`` member is
|
If ``Value`` is ``use_default`` then the ``value_type`` member is
|
||||||
@ -64,10 +64,10 @@ convertible to ``input_iterator_tag``.
|
|||||||
...................................
|
...................................
|
||||||
|
|
||||||
The type ``UnaryFunction`` must be Assignable, Copy Constructible, and
|
The type ``UnaryFunction`` must be Assignable, Copy Constructible, and
|
||||||
the expression ``f(*i)`` must be valid where ``f`` is an object of
|
the expression ``f(*i)`` must be valid where ``f`` is a const object of
|
||||||
type ``UnaryFunction``, ``i`` is an object of type ``Iterator``, and
|
type ``UnaryFunction``, ``i`` is an object of type ``Iterator``, and
|
||||||
where the type of ``f(*i)`` must be
|
where the type of ``f(*i)`` must be
|
||||||
``result_of<UnaryFunction(iterator_traits<Iterator>::reference)>::type``.
|
``result_of<const UnaryFunction(iterator_traits<Iterator>::reference)>::type``.
|
||||||
|
|
||||||
The argument ``Iterator`` shall model Readable Iterator.
|
The argument ``Iterator`` shall model Readable Iterator.
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ namespace boost
|
|||||||
// the function.
|
// the function.
|
||||||
typedef typename ia_dflt_help<
|
typedef typename ia_dflt_help<
|
||||||
Reference
|
Reference
|
||||||
, result_of<UnaryFunc(typename std::iterator_traits<Iterator>::reference)>
|
, result_of<const UnaryFunc(typename std::iterator_traits<Iterator>::reference)>
|
||||||
>::type reference;
|
>::type reference;
|
||||||
|
|
||||||
// To get the default for Value: remove any reference on the
|
// To get the default for Value: remove any reference on the
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
// Moved test of transform iterator into its own file. It to
|
// Moved test of transform iterator into its own file. It to
|
||||||
// to be in iterator_adaptor_test.cpp.
|
// to be in iterator_adaptor_test.cpp.
|
||||||
|
|
||||||
|
#include <boost/assert.hpp>
|
||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <boost/iterator/transform_iterator.hpp>
|
#include <boost/iterator/transform_iterator.hpp>
|
||||||
@ -106,12 +107,17 @@ struct polymorphic_mult_functor
|
|||||||
{
|
{
|
||||||
//Implement result_of protocol
|
//Implement result_of protocol
|
||||||
template <class FArgs> struct result;
|
template <class FArgs> struct result;
|
||||||
template <class F, class T> struct result<F(T )> {typedef T type;};
|
template <class F, class T> struct result<const F(T )> {typedef T type;};
|
||||||
template <class F, class T> struct result<F(T& )> {typedef T type;};
|
template <class F, class T> struct result<const F(T& )> {typedef T type;};
|
||||||
template <class F, class T> struct result<F(const T&)> {typedef T type;};
|
template <class F, class T> struct result<const F(const T&)> {typedef T type;};
|
||||||
|
template <class F, class T> struct result<F(T )> {typedef void type;};
|
||||||
|
template <class F, class T> struct result<F(T& )> {typedef void type;};
|
||||||
|
template <class F, class T> struct result<F(const T&)> {typedef void type;};
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
T operator()(const T& _arg) const {return _arg*2;}
|
T operator()(const T& _arg) const {return _arg*2;}
|
||||||
|
template <class T>
|
||||||
|
void operator()(const T& _arg) { BOOST_ASSERT(0); }
|
||||||
};
|
};
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Loading…
x
Reference in New Issue
Block a user