Boost C++ Libraries: Ticket #1127: multi_array views do not handle negative strides correctly https://svn.boost.org/trac10/ticket/1127 <p> Discovered in 1.33.1, but the code appears to be unchanged in 1.34.1. </p> <p> The attached test case fails. Compiling with FUDGED_RANGE causes the test case to work, but it shouldn't. The problem appears to be due to generate_array_view in boost/multi_array/base.hpp; it does not correctly handle negative strides. </p> <p> "len" is incorrectly calculated in the following code, when stride (and hence index_factor) is negative: </p> <blockquote> <p> index index_factor = current_range.stride(); index len = (finish - start + (index_factor - 1)) / index_factor; </p> </blockquote> <p> I was initially unsure as to whether negative strides were supported, but it is clear from other code in base.hpp that stride sign is carefully handled, so I it should be in the view. </p> <p> Phil Richards </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/1127 Trac 1.4.3 news@… Sat, 28 Jul 2007 20:25:31 GMT attachment set https://svn.boost.org/trac10/ticket/1127 https://svn.boost.org/trac10/ticket/1127 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">test_multi_array_view_neg_stride.cpp</span> </li> </ul> <p> Test case for mutli_array view with negative stride </p> Ticket Ronald Garcia Mon, 06 Aug 2007 19:40:48 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/1127#comment:1 https://svn.boost.org/trac10/ticket/1127#comment:1 <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/38482" title="Fixes #1127 array views were not handling negative strides properly. ...">[38482]</a>) Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/1127" title="#1127: Bugs: multi_array views do not handle negative strides correctly (closed: fixed)">#1127</a> array views were not handling negative strides properly. Thanks to Phil Richards for pointing that out. </p> Ticket