Boost C++ Libraries: Ticket #1581: Boost.MultiArray: Resizing bug if the index is not 0-based https://svn.boost.org/trac10/ticket/1581 <p> I find that a boost::multi_array will crash when calling to resize() with non 0-based indexes. The implementation seems have problem if the array is not 0-based. </p> <p> Please see the following code: </p> <pre class="wiki">#include &lt;boost/multi_array.hpp&gt; #include &lt;boost/array.hpp&gt; int main(int,char*[]) { typedef boost::multi_array&lt;int, 2&gt; marray; marray A(boost::extents[5][5]); boost::array&lt;marray::index, 2&gt; bases; bases[0] = 2; bases[1] = 3; A.reindex(bases); // bases[0] = 0; // bases[1] = 0; // A.reindex(bases); A.resize(boost::extents[7][7]); bases[0] = 2; bases[1] = 3; A.reindex(bases); return 0; } </pre><p> The above program will get crash unless you uncomment the 3 lines that re-index bases to 0. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/1581 Trac 1.4.3 Jeremiah Willcock Tue, 08 Jun 2010 22:18:30 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/1581#comment:1 https://svn.boost.org/trac10/ticket/1581#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">worksforme</span> </li> </ul> <p> This code passes for me with GCC 4.1.2, even under Valgrind. </p> Ticket