Boost logo

Boost :

From: helmut.zeisel_at_[hidden]
Date: 2001-07-17 10:13:40


--- In boost_at_y..., Marco Morandini <morandini_at_a...> wrote:
> Apologize for the question but
> I'm not very expert with C++.

Indeed, your question is not boost-specifc,
but C++ specific.

>
> If I uncomment the line
> //a.resize(8);
> then the program works fine.

Exactly.
There is a difference between resize and reserve:

To cite from Stroustrup, "The C++ Programming Language",
Section 16.3.8:

"The call of reserve ensures that there are no allocations
while the vector is built... Note that reserve doesn't
change the size of a vector..."

>
> Thanks in advance for your help/suggestions,
>

A better place for questions of that kind might be
the newsgroups comp.lang.c++ or comp.lang.c++.moderated.

Helmut


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