[Effective-cpp] Vector Capacity and Size

Adrian Fagg AdrianF at evaluategroup.com
Mon Dec 1 05:43:51 EST 2003


> -----Original Message-----
> From: Carol/Matthew Schroeder [mailto:bigoldog at earthlink.net]
> Sent: 01 December 2003 10:23

> this issue really came up in a conversation elsewhere.  The 
> point made to
> me was that leaving the growth strategy completely up to the 
> implementation
> is a flaw in the design of the STL.  In situations where 
> memory is critical
> and
> efficiency is secondary a vector becomes unusable or at best 
> implementation
> specific.

Interesting point - perhaps it would have been a better use of policy
classes than the half-baked allocators discussed elsewhere.

You still have the option of implementing your own vector like class for
such purposes. Vector is really quite a specialised container - just one
that's very convenient for a lot of general applications.
A good choice for the above criterion would often be boost::array.

Regards,

Adrian

Work: mailto:adrianf at evaluategroup.com
Home: mailto:adrian.fagg at ntlworld.com

Pretty pictures: http://homepage.ntlworld.com/rbyadf/ 
[ *** LongSig auto truncated *** ]

--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
---



More information about the Effective-cpp mailing list