Boost C++ Libraries: Ticket #8338: Iterator range does not work with pointer to array as iterator https://svn.boost.org/trac10/ticket/8338 <p> The following code: </p> <pre class="wiki">#include &lt;boost/range/iterator_range.hpp&gt; template &lt;typename T&gt; boost::iterator_range&lt;const T*&gt; one_element_range(const T&amp; t) { return boost::iterator_range&lt;const T*&gt;(&amp;t, &amp;t + 1); } int main() { one_element_range("foo"); } </pre><p> fails to compile with the following error: </p> <pre class="wiki">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&lt;char const (*)[4]&gt;' requested here one_element_range("foo"); ^ </pre><p> I think this use case (pointer to an array as an iterator) should be supported. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8338 Trac 1.4.3 Nathan Ridge Wed, 27 Mar 2013 02:04:47 GMT attachment set https://svn.boost.org/trac10/ticket/8338 https://svn.boost.org/trac10/ticket/8338 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">iterator-range-pointer-to-array.patch</span> </li> </ul> <p> patch + test </p> Ticket Nathan Ridge Wed, 27 Mar 2013 02:16:14 GMT <link>https://svn.boost.org/trac10/ticket/8338#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8338#comment:1</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/83596" title="[range] allow iterator_range to be instantiated with a pointer to an ...">[83596]</a>) [range] allow iterator_range to be instantiated with a pointer to an array as the iterator type (refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8338" title="#8338: Bugs: Iterator range does not work with pointer to array as iterator (closed: fixed)">#8338</a>) </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Nathan Ridge</dc:creator> <pubDate>Wed, 27 Mar 2013 02:17:56 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8338#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8338#comment:2</guid> <description> <p> Fixed in trunk. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Nathan Ridge</dc:creator> <pubDate>Tue, 18 Jun 2013 02:22:09 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/8338#comment:3 https://svn.boost.org/trac10/ticket/8338#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/84823" title="[range] Merge Boost.Range bug fixes to release branch (fixes #6944; ...">[84823]</a>) [range] Merge Boost.Range bug fixes to release branch (fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6944" title="#6944: Bugs: Some Range concepts use the incorrect Iterator concept (closed: fixed)">#6944</a>; fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7407" title="#7407: Bugs: istream_range does not compile with wcin (closed: fixed)">#7407</a>; fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7408" title="#7408: Bugs: istream_range should not pull istream (closed: fixed)">#7408</a>; fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7731" title="#7731: Bugs: irange doesn't end iteration properly when step_size is 3 or more (closed: fixed)">#7731</a>; fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7827" title="#7827: Bugs: [range] cant compile r | indexed to range algorithm (closed: fixed)">#7827</a>; fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8338" title="#8338: Bugs: Iterator range does not work with pointer to array as iterator (closed: fixed)">#8338</a>; fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8453" title="#8453: Bugs: Incorrect configuration macro BOOST_NO_PARTIAL_TEMPLATE_SPECIALIZATION (closed: fixed)">#8453</a>). </p> Ticket Nathan Ridge Tue, 18 Jun 2013 02:23:22 GMT <link>https://svn.boost.org/trac10/ticket/8338#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8338#comment:4</guid> <description> <p> Fixed for 1.54. </p> </description> <category>Ticket</category> </item> </channel> </rss>