There are two functions for deleting the contents of a string:
clear and erase (the latter
returns the string).
void
clear() { _M_mutate(0, this->size(), 0); }
basic_string&
erase(size_type __pos = 0, size_type __n = npos)
{
return this->replace(_M_check(__pos), _M_fold(__pos, __n),
_M_data(), _M_data());
}
The implementation of erase seems to be more
complicated (from libstdc++-v3), but clear is not
implemented in gcc 2.95.x's libstdc++, so you should use
erase (which is probably faster than
operator=(charT*)).
