Boost logo

Boost :

From: boost (boost_at_[hidden])
Date: 2001-12-06 17:15:29


Salut,

On Thursday 06 December 2001 12:26, Toon Knapen wrote:

> > What about the following idea:
> > -> resize( n1, n2) garanties "to hold size1 rows of size2 elements".
> > -> reserve(n3, n4) garanties that as long n3>=n1, n4 >=n2 no allocations
> > in resize(n1,n2) are performed.
>
> I would say that the condition is that n3*n4 >= n1*n2.
>
> > if n3<n1 or n4 < n2 the matrix is allowed to
> > shrink to the reserved size if requested in a subsequent resize(..) in
> > order to minimize wasted memory.
> > But this would lead to the notion of a minimal_capacity().
>
> I don't know if this is a good idea. First it slightly differs from
>
> the vector.reserve call and slight differences from a standard always
>
> lead to subtle bugs. Secondly, if you really want to 'shrink' the matrix,
>
> copy it to another with the desired size. This would need to be done
> internally also.

Last night I thought there's some possibility for optimizations, but you're
right, it's just confusing.

Best wishes,
Peter


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