On Tuesday, June 10, 2003, at 10:15 PM, Duane Murphy wrote:
--- At Tue, 10 Jun 2003 16:19:54 -0400, Daryle Walker wrote: [SNIP]
But my point was that if the OP only needed a simple byte bucket, he could just allocate one without complicating matters with a full-blown object. It's more efficient because the multi-byte processing function only works with simple byte buckets.
This used to be my consensus as well. However, after reading Meyer's More Effective STL as well as several CUJ articles I became convinced that there was virtually no overhead and lots of convenience to actually using a vector instead of "raw" storage. The automatic size management coupled with automatic destruction is a huge win over raw allocated storage management. In addition, most standard libraries have optimized vectors for pod's that remove the overhead of constructing and destructing intrinsic types and pointers.
My conclusion was that vector<> is your friend. :-)
If we just need the automation, we could make an array-variant of std::auto_ptr<>. I did that once on my previous computer. Maybe I should make a submission for boost::auto_array<>. Daryle