[Boost-bugs] [Boost C++ Libraries] #8338: Iterator range does not work with pointer to array as iterator

Subject: [Boost-bugs] [Boost C++ Libraries] #8338: Iterator range does not work with pointer to array as iterator
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-03-27 01:50:35


#8338: Iterator range does not work with pointer to array as iterator
-------------------------------------+--------------------------------------
 Reporter: nathanridge | Owner: neilgroves
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: range
  Version: Boost Development Trunk | Severity: Problem
 Keywords: |
-------------------------------------+--------------------------------------
 The following code:

 {{{
 #include <boost/range/iterator_range.hpp>

 template <typename T>
 boost::iterator_range<const T*> one_element_range(const T& t)
 {
     return boost::iterator_range<const T*>(&t, &t + 1);
 }

 int main()
 {
     one_element_range("foo");
 }
 }}}

 fails to compile with the following error:

 {{{
 In file included from test.cpp:1:
 In file included from boost/range/iterator_range.hpp:13:
 boost/range/iterator_range_core.hpp:349:12: error: function cannot return
 array type 'abstract_value_type' (aka 'char [4]')
            abstract_value_type operator()( difference_type at ) const
            ^
 test2.cpp:11:5: note: in instantiation of template class
 'boost::iterator_range<char const (*)[4]>' requested here
     one_element_range("foo");
     ^
 }}}

 I think this use case (pointer to an array as an iterator) should be
 supported.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8338>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:12 UTC