Containers: assignment, construction from
Gerald Pfeifer
pfeifer@dbai.tuwien.ac.at
Fri Feb 18 08:05:00 GMT 2000
On Fri, 18 Feb 2000, Anjul wrote:
> Is there a better list to post this question to?
Use one of the C++ newsgroups, but have a look at the documentation at
http://www.sgi.com/Technology/STL/ first, there's lot of interesting
stuff.
> The reason I prefer this is to avoid needless construction of blank
> elements in the first case. Yes, I could create a vector of size 0 and
> use a back_inserter as an argument to the copy command, but then, I
> may run into repeated "reallocs" (extensions), some of which may
> necessiate copying the entire vector.
You want to use vector<>::reserve().
Gerald
--
Gerald "Jerry" pfeifer@dbai.tuwien.ac.at http://www.dbai.tuwien.ac.at/~pfeifer/
More information about the Gcc
mailing list