Simplified char buffer construction

This commit is contained in:
Bob Polis 2021-12-01 16:12:32 +01:00
parent cdd1fed777
commit 2121c50735

View File

@ -82,8 +82,7 @@ string sc::file_get_contents(const string& path)
file.seekg(0, ios::end);
ios::pos_type file_len {file.tellg()};
file.seekg(0);
vector<char> buf;
buf.resize(file_len);
vector<char> buf(file_len);
file.read(buf.data(), file_len);
return {buf.data(), static_cast<string::size_type>(file_len)};
}