Merge pull request #20143 from janisozaur/gcc-13.1

Fix compatibility with GCC 13.1
This commit is contained in:
Matthias Moninger 2023-05-07 22:09:17 +03:00 committed by GitHub
commit 4afa56e373
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -73,7 +73,13 @@ public:
{
throw std::runtime_error("Unable to open " + path);
}
return std::string((std::istreambuf_iterator<char>(fs)), std::istreambuf_iterator<char>());
fs.seekg(0, fs.end);
auto length = fs.tellg();
fs.seekg(0, fs.beg);
std::unique_ptr<char[]> buffer = std::make_unique<char[]>(length);
fs.read(buffer.get(), length);
auto result = std::string(buffer.get(), buffer.get() + length);
return result;
}
/**