std::string has a .reserve method for pre-allocation.
std::string s;
s.reserve(1048576); // reserve 1 MB
read_file_into(s);
std::string has a .reserve method for pre-allocation.
std::string s;
s.reserve(1048576); // reserve 1 MB
read_file_into(s);