Boost logo

Boost :

From: boost (boost_at_[hidden])
Date: 2001-12-13 01:29:44


Salut,

On Wednesday 12 December 2001 23:07, you wrote:

> > So, case 1 should look like
> >
> >
> > if (new_size1 <= m.capacity1 () && new_size2 <= m.capacity2 ())
> > m.resize (new_size1, new_size2);
> > else if (new_size1 * new_size2 <= m.capacity ())
> > {
> > std::cout << "Warning: Matrix is reshaped" << std::endl;
> > m.resize (new_size1, new_size2);
>
> Isn't it necessary to reallocate here (internally), if the matrix m
> is (internally) organized as a 2-D container like
> vector<vector<double> > and new_size1 > m.size1(), for example?

Sure, that was for case 1 only.
The only thing I've wanted to say is that capacity in case 1) leads
to the notion of reshaping.

Anyway I think the submatrix(...) seems to be superior to the
reserve().

Bets wishes,
Peter


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk