Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r83596 - in trunk: boost/range libs/range/test
From: zeratul976_at_[hidden]
Date: 2013-03-26 22:16:12


Author: nathanridge
Date: 2013-03-26 22:16:11 EDT (Tue, 26 Mar 2013)
New Revision: 83596
URL: http://svn.boost.org/trac/boost/changeset/83596

Log:
[range] allow iterator_range to be instantiated with a pointer to an array as the iterator type (refs #8338)
Text files modified:
   trunk/boost/range/iterator_range_core.hpp | 5 ++++-
   trunk/libs/range/test/iterator_range.cpp | 5 +++++
   2 files changed, 9 insertions(+), 1 deletions(-)

Modified: trunk/boost/range/iterator_range_core.hpp
==============================================================================
--- trunk/boost/range/iterator_range_core.hpp (original)
+++ trunk/boost/range/iterator_range_core.hpp 2013-03-26 22:16:11 EDT (Tue, 26 Mar 2013)
@@ -21,7 +21,9 @@
 #include <boost/assert.hpp>
 #include <boost/iterator/iterator_traits.hpp>
 #include <boost/iterator/iterator_facade.hpp>
+#include <boost/mpl/or.hpp>
 #include <boost/type_traits/is_abstract.hpp>
+#include <boost/type_traits/is_array.hpp>
 #include <boost/type_traits/is_pointer.hpp>
 #include <boost/range/functions.hpp>
 #include <boost/range/iterator.hpp>
@@ -167,7 +169,8 @@
 
         private: // for return value of operator()()
             typedef BOOST_DEDUCED_TYPENAME
- boost::mpl::if_< boost::is_abstract<value_type>,
+ boost::mpl::if_< boost::mpl::or_< boost::is_abstract< value_type >,
+ boost::is_array< value_type > >,
                                  reference, value_type >::type abstract_value_type;
 
         public:

Modified: trunk/libs/range/test/iterator_range.cpp
==============================================================================
--- trunk/libs/range/test/iterator_range.cpp (original)
+++ trunk/libs/range/test/iterator_range.cpp 2013-03-26 22:16:11 EDT (Tue, 26 Mar 2013)
@@ -101,6 +101,11 @@
     BOOST_CHECK( rrr == str );
 
     check_reference_type();
+
+ // Check that an iterator range can be instantiated with
+ // a pointer to an array as an iterator.
+ int arr[2][2];
+ boost::make_iterator_range(arr, arr + 2);
 }
 
 namespace iterator_range_test_detail


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