Boost logo

Boost :

From: Neal D. Becker (nbecker_at_[hidden])
Date: 2002-08-09 13:47:53


>>>>> "Victor" == Victor A Wagner, <vawjr_at_[hidden]> writes:

    Victor> At Wednesday 2002/08/07 14:02, you wrote:
>> "Philippe A. Bouchard" <philippeb_at_[hidden]> wrote in message
>> news:airm8o$u3k$1_at_main.gmane.org...
>> > > More comments:
>> > >
>> > > Your code results in undefined behaviour, since it accesses vector
>> > > elements that have not been constructed. Even though the data type
>> > > is POD, accessing vector[i] where i >= vector.size() is not legal C++.
>> >
>> > Why is it public then? There's a flaw in their standards therefore.
>>
>> If I use resize() instead, will it shrink down the allocated block (exactly
>> what I don't want) if the new size is smaller than the previous one?

    Victor> from all the books I've read, resize() will NOT shrink a vector

Depends what you mean by "shrink". The resulting vector should report
the new size. Whether memory is actually freed is a different
question.


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