Boost logo

Boost Users :

Subject: [Boost-users] [Boost.MultiArray]: size question
From: gast128 (gast128_at_[hidden])
Date: 2012-12-17 10:50:49


Dear all,

we use here the multi_array as a 2 dimensional matrix. Often we want to resize
the row or column dependent on some GUI event. Code could be:

void Bla::ResizeRows(size_t nRows)
{
   m_matrix.resize(boost::extents[nRows][m_matrix[0].size()]);
}

However this uses the 0-index of row count (i.e. 'm_matrix[0].size()') to
determine the size of the columns. Will this not crash if you have 0 rows? And
if so is there a better alternative?

wkr.

 


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net