Boost C++ Libraries: Ticket #11650: boost range size() fails concept on subarray of a const multi_array https://svn.boost.org/trac10/ticket/11650 <p> Small test case: </p> <pre class="wiki">#include &lt;boost/range/size.hpp&gt; #include &lt;boost/multi_array.hpp&gt; using namespace boost; typedef multi_array&lt;float, 2&gt; myarray; myarray a; const myarray const_a; void test() { boost::size( a[0] ); // Compiles fine boost::size( const_a ); // Compiles fine boost::size( const_a[0] ); // Fails single pass range concept } </pre><p> gives me the attached errors. I'm using gcc 4.8.4 on Ubuntu 14.04 with boost 1.59.0 </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11650 Trac 1.4.3 John Reid <johnbaronreid@…> Mon, 14 Sep 2015 10:06:36 GMT attachment set https://svn.boost.org/trac10/ticket/11650 https://svn.boost.org/trac10/ticket/11650 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">errors.txt</span> </li> </ul> <p> Compilation errors </p> Ticket Neil Groves Mon, 14 Sep 2015 15:21:31 GMT <link>https://svn.boost.org/trac10/ticket/11650#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11650#comment:1</guid> <description> <p> It appears that the multi_array const_sub_array is not a valid model of a <a class="missing wiki">RandomAccessRange</a> Concept because the iterator type id not defined. </p> <p> A change to multi_array could make it work, I see two possibilities: </p> <ol><li>Implement const_sub_array::iterator to be equal to const_sub_array::const_iterator. This has been done in Boost.Range sub_range without issue for sometime. This is semantically very similar since it needs to preserve constant-ness from a template parameter. </li><li>The multi_array could have a specialization of boost::range_iterator to avoid using the default Boost.Range iterator type deduction. </li></ol><p> My recommendation would be 1. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Neil Groves</dc:creator> <pubDate>Mon, 14 Sep 2015 15:21:53 GMT</pubDate> <title>owner, component changed https://svn.boost.org/trac10/ticket/11650#comment:2 https://svn.boost.org/trac10/ticket/11650#comment:2 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Neil Groves</span> to <span class="trac-author">Ronald Garcia</span> </li> <li><strong>component</strong> <span class="trac-field-old">range</span> → <span class="trac-field-new">multi_array</span> </li> </ul> Ticket