Opened 10 years ago
#8339 new Bugs
Iterator facade does not work for const iterator with array value type
Reported by: | Nathan Ridge | Owned by: | jeffrey.hellrung |
---|---|---|---|
Milestone: | To Be Determined | Component: | iterator |
Version: | Boost Development Trunk | Severity: | Problem |
Keywords: | Cc: |
Description
The following code fails to compile:
#include <boost/iterator/iterator_facade.hpp> struct iterator : boost::iterator_facade<iterator, char [4], boost::random_access_traversal_tag, char const (&)[4]> { };
(I omitted the body of the derived class, but that's irrelevant, it's not what's causing the error).
The error is:
In file included from test.cpp:1: In file included from boost/iterator/iterator_facade.hpp:17: boost/iterator/detail/operator_brackets_dispatch.hpp:33:12: error: function cannot return array type 'result_type' (aka 'char [4]') static result_type apply(Iterator const & i) ^ boost/iterator/iterator_facade.hpp:583:16: note: in instantiation of template class 'boost::detail::operator_brackets_value<char [4]>' requested here typename operator_brackets_dispatch_::result_type ^ test.cpp:3:19: note: in instantiation of template class 'boost::iterator_facade<iterator, char [4], boost::random_access_traversal_tag, char const (&)[4], long>' requested here struct iterator : boost::iterator_facade<iterator, ^ In file included from test.cpp:1: boost/iterator/iterator_facade.hpp:583:7: error: function cannot return array type 'typename operator_brackets_dispatch_::result_type' (aka 'char [4]') typename operator_brackets_dispatch_::result_type ^ test.cpp:3:19: note: in instantiation of template class 'boost::iterator_facade<iterator, char [4], boost::random_access_traversal_tag, char const (&)[4], long>' requested here struct iterator : boost::iterator_facade<iterator, ^
It would be great if this use case could be supported.
Note:
See TracTickets
for help on using tickets.