Ticket #8338: iterator-range-pointer-to-array.patch

File iterator-range-pointer-to-array.patch, 1.6 KB (added by Nathan Ridge, 10 years ago)

patch + test

  • boost/range/iterator_range_core.hpp

     
    2121#include <boost/assert.hpp>
    2222#include <boost/iterator/iterator_traits.hpp>
    2323#include <boost/iterator/iterator_facade.hpp>
     24#include <boost/mpl/or.hpp>
    2425#include <boost/type_traits/is_abstract.hpp>
     26#include <boost/type_traits/is_array.hpp>
    2527#include <boost/type_traits/is_pointer.hpp>
    2628#include <boost/range/functions.hpp>
    2729#include <boost/range/iterator.hpp>
     
    167169
    168170        private: // for return value of operator()()
    169171            typedef BOOST_DEDUCED_TYPENAME
    170                 boost::mpl::if_< boost::is_abstract<value_type>,
     172                boost::mpl::if_< boost::mpl::or_< boost::is_abstract< value_type >,
     173                                                  boost::is_array< value_type > >,
    171174                                 reference, value_type >::type abstract_value_type;
    172175
    173176        public:
  • libs/range/test/iterator_range.cpp

     
    101101    BOOST_CHECK( rrr == str );
    102102
    103103    check_reference_type();
     104   
     105    // Check that an iterator range can be instantiated with
     106    // a pointer to an array as an iterator.
     107    int arr[2][2];
     108    boost::make_iterator_range(arr, arr + 2);
    104109}
    105110
    106111namespace iterator_range_test_detail