Variable sized char array with minimizing calls to new?
<p>I need a char array that will dynamically change in size. I do not know how big it can get so preallocating is not an option. It could never get any bigger than 20 bytes 1 time, the next time it may get up to 5kb...</p>

<p>I want the allocation to be like a std vector.</p>

<p>I thought of using a std vector &lt; char > but all those push backs seem like they waste time:</p>

<pre><code>strVec.clear();
for(size_t i = 0; i &lt; varLen; ++i)
{
   strVec.push_back(0);
}
</code></pre>

<p>Is this the best I can do or is there a way to add a bunch of items to a vector at once? Or maybe a better way to do this.</p>

<p>Thanks</p>
