I need to copy a file into a string. I need someway to preallocate memory for that string object and a way to directly read the file content into that string's memory?
I need to copy a file into a string. I need someway to preallocate memory for that string object and a way to directly read the file content into that string's memory?
std::string::resize() actually allocates the required space.
std::string::reserve() may not (it's a request).