[range] allow iterator_range to be instantiated with a pointer to an array as the iterator type (refs #8338)

[SVN r83596]
This commit is contained in:
Nathan Ridge
2013-03-27 02:16:11 +00:00
parent 4971da58ee
commit fe79a8efdd
2 changed files with 9 additions and 1 deletions

View File

@ -21,7 +21,9 @@
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <boost/iterator/iterator_traits.hpp> #include <boost/iterator/iterator_traits.hpp>
#include <boost/iterator/iterator_facade.hpp> #include <boost/iterator/iterator_facade.hpp>
#include <boost/mpl/or.hpp>
#include <boost/type_traits/is_abstract.hpp> #include <boost/type_traits/is_abstract.hpp>
#include <boost/type_traits/is_array.hpp>
#include <boost/type_traits/is_pointer.hpp> #include <boost/type_traits/is_pointer.hpp>
#include <boost/range/functions.hpp> #include <boost/range/functions.hpp>
#include <boost/range/iterator.hpp> #include <boost/range/iterator.hpp>
@ -167,7 +169,8 @@ namespace boost
private: // for return value of operator()() private: // for return value of operator()()
typedef BOOST_DEDUCED_TYPENAME 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; reference, value_type >::type abstract_value_type;
public: public:

View File

@ -101,6 +101,11 @@ void check_iterator_range()
BOOST_CHECK( rrr == str ); BOOST_CHECK( rrr == str );
check_reference_type(); 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 namespace iterator_range_test_detail