Fix warning on older gcc versions
This commit is contained in:
parent
0b5f90a365
commit
f069733650
@ -5,17 +5,18 @@ using std::istream;
|
||||
using std::ofstream;
|
||||
using std::ifstream;
|
||||
using std::ios;
|
||||
using boost::optional;
|
||||
|
||||
namespace bf = boost::filesystem;
|
||||
|
||||
namespace cpputils {
|
||||
|
||||
boost::optional<Data> Data::LoadFromFile(const bf::path &filepath) {
|
||||
optional<Data> Data::LoadFromFile(const bf::path &filepath) {
|
||||
ifstream file(filepath.c_str(), ios::binary);
|
||||
if (!file.good()) {
|
||||
return boost::none;
|
||||
}
|
||||
auto result = LoadFromStream(file);
|
||||
optional<Data> result(LoadFromStream(file));
|
||||
if (!file.good()) {
|
||||
throw std::runtime_error("Error reading from file");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user