[Exceptional C++ Style] Item 21: Containers in Memory, Part 2: How Big Is It Really?

Ric Parkin ric.parkin at ntlworld.com
Thu Jan 13 09:12:55 EST 2005


From: "Balog Pal" <pasa at lib.hu>
> Date: 2005/01/13 Thu PM 12:53:27 GMT
> To: <effective-cpp at accu.org>
> Subject: [Exceptional C++ Style] Item 21:  Containers in Memory,
> 	Part 2: How Big Is It Really?
> 
> Item 21: Containers in Memory, Part 2: How big is it really?

I think there's a subtlety lost in the per-element overhead for vector: in order to meet the vector's complexity requirements for push_back (amortized constant time), the amount of memory requested will often be more than actually needed, and the overhead will on average be proportional to the number of elements.

Ric


-----------------------------------------
Email provided by http://www.ntlhome.com/





More information about the Effective-cpp mailing list