So there's a ton of cases where this it needed in performance sensitive applications, and I'm finally at the straw that broke the camels back. It needs to compile in C++98, as at least one of our platform only guarantees C++98 compliance.
Edited hopefully to be a bit more clear with what I want.
Example:
// This will allocate storage for 1024, and then loop 1024 times touching all of it just to place a 0 in it
std::vector< char > buffer( 1024 );
// Now read will write into that buffer, overwriting the 0s ( we payed for the fill unnecessarily )
buffer.resize( read( someSource, &buffer[0], buffer.size() ) );
This is the common C interface, used with nearly all C libraries for writing data to a buffer. The same problems arise when dealing with buffers containing primitives in general. New resize would instead look something like this:
// Disabled for anything which doesn't pass boost::is_POD< T >, they get the standard version
void resize( size_t a_NewSize )
{
reserve( a_NewSize );
_end = _begin + a_NewSize;
}
construct_back would be a forwarding constructor, for 1 const argument it would look something like this ( untested ):
template< typename T1 >
void construct_back( const T1& a_Arg1 )
{
if( capacity() <= size() ) // No room
reserve( size() + 1 );
// Construct in place using Ts constructor that accepts const T1&
new (&(*end()) T( T1 );
++_end; // Account for new element
}
construct_back would have to have all the possible number of arguments^2 overloads, this is the common brute force approach for perfect forwarding in C++98.