From fe79a8efdd44de009049be207fb1511b167fafc3 Mon Sep 17 00:00:00 2001 From: Nathan Ridge Date: Wed, 27 Mar 2013 02:16:11 +0000 Subject: [PATCH] [range] allow iterator_range to be instantiated with a pointer to an array as the iterator type (refs #8338) [SVN r83596] --- include/boost/range/iterator_range_core.hpp | 5 ++++- test/iterator_range.cpp | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/boost/range/iterator_range_core.hpp b/include/boost/range/iterator_range_core.hpp index 60c7670..6e68992 100644 --- a/include/boost/range/iterator_range_core.hpp +++ b/include/boost/range/iterator_range_core.hpp @@ -21,7 +21,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -167,7 +169,8 @@ namespace boost private: // for return value of operator()() typedef BOOST_DEDUCED_TYPENAME - boost::mpl::if_< boost::is_abstract, + boost::mpl::if_< boost::mpl::or_< boost::is_abstract< value_type >, + boost::is_array< value_type > >, reference, value_type >::type abstract_value_type; public: diff --git a/test/iterator_range.cpp b/test/iterator_range.cpp index a53ef16..c914f43 100644 --- a/test/iterator_range.cpp +++ b/test/iterator_range.cpp @@ -101,6 +101,11 @@ void check_iterator_range() 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