Boost logo

Ublas :

From: Gunter Winkler (guwi17_at_[hidden])
Date: 2007-12-05 17:31:21

Am Montag, 3. Dezember 2007 04:01 schrieb e r:
> hi All,
> is ublas::vector<>.resize(N) efficient like std::vector<>.resize(N)
> and bounded_array<>.resize(N)?
> by that i mean that if N<current size, does it use the SAME chunk of
> currently allocated memory or does it allocated NEW one?

The answer is in storage.hpp at line 113 (unbounded_array::resize):

any resize is handled the same way - new storage is allocated and the
data is copied if requested.

The rationale is: If a shrink of a (possibly) large vector is requested
then the allocated memory shall be returned.