Boost logo

Boost :

From: Victor A. Wagner, Jr. (vawjr_at_[hidden])
Date: 2002-08-11 04:03:19


I understand, I thought perhaps Phillippe didn't.
At Friday 2002/08/09 11:47, you wrote:
> >>>>> "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.
>
>_______________________________________________
>Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Victor A. Wagner Jr. http://rudbek.com
PGP RSA fingerprint = 4D20 EBF6 0101 B069 3817 8DBF C846 E47A
PGP D-H fingerprint = 98BC 65E3 1A19 43EC 3908 65B9 F755 E6F4 63BB 9D93
The five most dangerous words in the English language:
               "There oughta be a law"


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