I wan to use std::string simply to create a dynamic buffer and than iterate through it using an index. Is resize() the only function to actually allocate the buffer?
std::vector
instead of std::string
might also be a solution - if there are no requirements against it.
vector v; // empty vector
vector v(10); // vector with space for 10 elements, here char's
Your example:
vector my_string(20);
int i=0;
for ( parsing_something_else_loop )
{
char ch = ;
my_string[i++] = ch;
}