|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r78121 - in trunk: boost/iterator libs/iterator/doc libs/iterator/test
From: jeffrey.hellrung_at_[hidden]
Date: 2012-04-21 21:27:50
Author: jeffrey.hellrung
Date: 2012-04-21 21:27:49 EDT (Sat, 21 Apr 2012)
New Revision: 78121
URL: http://svn.boost.org/trac/boost/changeset/78121
Log:
refs #5127 applying Michael Morin's patch for transform_iterator to trunk
Text files modified:
trunk/boost/iterator/transform_iterator.hpp | 2 +-
trunk/libs/iterator/doc/transform_iterator.html | 6 +++---
trunk/libs/iterator/doc/transform_iterator_ref.rst | 6 +++---
trunk/libs/iterator/test/transform_iterator_test.cpp | 12 +++++++++---
4 files changed, 16 insertions(+), 10 deletions(-)
Modified: trunk/boost/iterator/transform_iterator.hpp
==============================================================================
--- trunk/boost/iterator/transform_iterator.hpp (original)
+++ trunk/boost/iterator/transform_iterator.hpp 2012-04-21 21:27:49 EDT (Sat, 21 Apr 2012)
@@ -46,7 +46,7 @@
// the function.
typedef typename ia_dflt_help<
Reference
- , result_of<UnaryFunc(typename std::iterator_traits<Iterator>::reference)>
+ , result_of<const UnaryFunc(typename std::iterator_traits<Iterator>::reference)>
>::type reference;
// To get the default for Value: remove any reference on the
Modified: trunk/libs/iterator/doc/transform_iterator.html
==============================================================================
--- trunk/libs/iterator/doc/transform_iterator.html (original)
+++ trunk/libs/iterator/doc/transform_iterator.html 2012-04-21 21:27:49 EDT (Sat, 21 Apr 2012)
@@ -99,7 +99,7 @@
</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
<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>
<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,
@@ -117,10 +117,10 @@
<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>
<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
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>
</div>
<div class="section" id="transform-iterator-models">
Modified: trunk/libs/iterator/doc/transform_iterator_ref.rst
==============================================================================
--- trunk/libs/iterator/doc/transform_iterator_ref.rst (original)
+++ trunk/libs/iterator/doc/transform_iterator_ref.rst 2012-04-21 21:27:49 EDT (Sat, 21 Apr 2012)
@@ -41,7 +41,7 @@
If ``Reference`` is ``use_default`` then the ``reference`` member of
``transform_iterator`` is
-``result_of<UnaryFunction(iterator_traits<Iterator>::reference)>::type``.
+``result_of<const UnaryFunction(iterator_traits<Iterator>::reference)>::type``.
Otherwise, ``reference`` is ``Reference``.
If ``Value`` is ``use_default`` then the ``value_type`` member is
@@ -64,10 +64,10 @@
...................................
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
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.
Modified: trunk/libs/iterator/test/transform_iterator_test.cpp
==============================================================================
--- trunk/libs/iterator/test/transform_iterator_test.cpp (original)
+++ trunk/libs/iterator/test/transform_iterator_test.cpp 2012-04-21 21:27:49 EDT (Sat, 21 Apr 2012)
@@ -12,6 +12,7 @@
// Moved test of transform iterator into its own file. It to
// to be in iterator_adaptor_test.cpp.
+#include <boost/assert.hpp>
#include <boost/config.hpp>
#include <algorithm>
#include <boost/iterator/transform_iterator.hpp>
@@ -106,12 +107,17 @@
{
//Implement result_of protocol
template <class FArgs> struct result;
- template <class F, class T> struct result<F(T )> {typedef T type;};
- template <class F, class T> struct result<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(T )> {typedef T type;};
+ template <class F, class T> struct result<const F(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>
T operator()(const T& _arg) const {return _arg*2;}
+ template <class T>
+ void operator()(const T& _arg) { BOOST_ASSERT(0); }
};
int
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk