[Boost-bugs] [Boost C++ Libraries] #1581: Boost.MultiArray: Resizing bug if the index is not 0-based

Subject: [Boost-bugs] [Boost C++ Libraries] #1581: Boost.MultiArray: Resizing bug if the index is not 0-based
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-01-19 10:22:09


#1581: Boost.MultiArray: Resizing bug if the index is not 0-based
---------------------------------------+------------------------------------
 Reporter: avhacker_at_[hidden] | Owner: garcia
     Type: Bugs | Status: new
Milestone: Boost 1.36.0 | Component: multi_array
  Version: Boost 1.34.1 | Severity: Problem
 Keywords: multiarray resize reindex |
---------------------------------------+------------------------------------
 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.

 Please see the following code:


 {{{
 #include <boost/multi_array.hpp>
 #include <boost/array.hpp>

 int main(int,char*[])
 {
         typedef boost::multi_array<int, 2> marray;
         marray A(boost::extents[5][5]);

         boost::array<marray::index, 2> 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;
 }
 }}}

 The above program will get crash unless you uncomment the 3 lines that re-
 index bases to 0.

--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/1581>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.


This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:57 UTC